text:
class GroupUser < ActiveRecord::Base
  belongs_to :user
  belongs_to :group

  POSITION = %w(なし リーダー サブリーダー).freeze

  module Select
    POSITION = POSITION.map.with_index { |pos, i| [pos, i] }
  end
end

redpajama_set_name: RedPajamaGithub


text:
package com.hantsylabs.example.spring.es;

import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;

public interface ESPostRepository
		extends ElasticsearchRepository<ESPost, String>{

}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;

namespace GM_Tools
{
    public class ResManager
    {
        public struct StructResReader
        {
            public short nFileNameLength;
            public string strFileName;
            public int nFileSize;
            public TimeSpan time_;
            public int nFilePosition;
            public string strFileContents;
        }

        public StructResReader[] SubFiles;
        public int nTotalFiles;

        public void LoadRes( string strResourceName )
        {
            FileStream ResDataInto;
            ResDataInto = File.OpenRead(strResourceName);
            BinaryReader byteread = new BinaryReader(ResDataInto);

            byte byEncryptionKey    = byteread.ReadByte();
            bool bEncryption        = byteread.ReadByte() != 0;
            int  nFileHeaderSize    = byteread.ReadInt32();
            byte[] byFileHeader    = byteread.ReadBytes(nFileHeaderSize);
            //Decryptage de La Table des fichiers
            for (int i = 0; i < nFileHeaderSize; i++)
            {
                byFileHeader[i] = (byte)((16 * (byEncryptionKey ^ (byte)~byFileHeader[i])) | ((byEncryptionKey ^ (byte)~byFileHeader[i]) >> 4));
            }
            BinaryReader BrDecryptTableFile       = new BinaryReader(new MemoryStream(byFileHeader));
            byte[] byVersion                    = BrDecryptTableFile.ReadBytes(7);
            int  nFileNumber                    = BrDecryptTableFile.ReadInt16();

           SubFiles = new StructResReader[nFileNumber];
            nTotalFiles = nFileNumber;
            for (int i = 0; i < nFileNumber; i++)
            {
                SubFiles[i].nFileNameLength = BrDecryptTableFile.ReadInt16();
                SubFiles[i].strFileName     = Encoding.ASCII.GetString(BrDecryptTableFile.ReadBytes(SubFiles[i].nFileNameLength));
                SubFiles[i].nFileSize       = BrDecryptTableFile.ReadInt32();
                SubFiles[i].time_           = TimeSpan.FromSeconds(BrDecryptTableFile.ReadInt32());
                SubFiles[i].nFilePosition   = BrDecryptTableFile.ReadInt32();

                byteread.BaseStream.Seek(SubFiles[i].nFilePosition, SeekOrigin.Begin);

                byte[] byFileContents = byteread.ReadBytes(SubFiles[i].nFileSize);

                if (bEncryption)
                {
                    // si fichier est crypter on utilise la clé + les fonctions algebre
                    for (int j = 0; j < SubFiles[i].nFileSize; j++)
                    {
                        byFileContents[j] = (byte)((16 * (byEncryptionKey ^ (byte)~byFileContents[j])) | ((byEncryptionKey ^ (byte)~byFileContents[j]) >> 4));
                    }
                }
                // On encrypte le contenu pour ne pas le modifier a cause de l'encodage
                SubFiles[i].strFileContents = Convert.ToBase64String(byFileContents);
            }
        }

        public void SaveAllDecryptRes()
        {
            System.IO.Directory.CreateDirectory("ExtractedRes");
            for (int i = 0; i < nTotalFiles; i++)
            {
                string FilePath = "ExtractedRes/" + SubFiles[i].strFileName;
                using (System.IO.FileStream fs = System.IO.File.Create(FilePath))
                {
                    // on vire les curieux glif ?
                    if(SubFiles[i].strFileContents.Substring(0, 2) == "\x3f\x3f")
                    {
                        SubFiles[i].strFileContents = SubFiles[i].strFileContents.Substring(2);
                    }

                    // on supprime les NULL
                    SubFiles[i].strFileContents = SubFiles[i].strFileContents.Replace("\x00", "");

                    // on décrypt et on envois sans encodage
                    byte[] byFileContent = Convert.FromBase64String(SubFiles[i].strFileContents);
                    fs.Write(byFileContent, 0, byFileContent.Length);
                    fs.Close();
                }
            }

        }

        public void EmptyMemory()
        {
            SubFiles = null;
            nTotalFiles = 0;
        }

    }
}


text:
//
//  SANetworkResponse.m
//  ECM
//
//  Created by 学宝 on 16/1/16.
//  Copyright © 2016年 浙江网仓科技有限公司. All rights reserved.
//

#import "SANetworkResponse.h"
#import "SANetworkConfig.h"

@interface SANetworkResponse ()

@property (nonatomic, copy) id responseData;
@property (nonatomic, assign, readwrite) SANetworkStatus networkStatus;
@property (nonatomic, assign, readwrite) NSInteger requestTag;
@property (nonatomic, assign, readwrite) BOOL isCache;

@property (nonatomic, copy, readwrite) NSString *responseMessage;

@property (nonatomic, copy, readwrite) id responseContentData;
@property (nonatomic, assign, readwrite) NSInteger responseCode;

@end

@implementation SANetworkResponse

- (instancetype)initWithResponseData:(id)responseData requestTag:(NSInteger)requestTag networkStatus:(SANetworkStatus)networkStatus {
    self = [super init];
    if (self) {
        _responseData = responseData;
        _requestTag = requestTag;
        _isCache = networkStatus == SANetworkResponseDataCacheStatus ? YES:NO;
        _networkStatus = networkStatus;

        _responseCode = NSNotFound;
        switch (networkStatus) {
            case SANetworkResponseDataSuccessStatus:
            case SANetworkResponseDataCacheStatus:
            case SANetworkResponseDataIncorrectStatus:{
                if ([responseData isKindOfClass:[NSDictionary class]]) {
                    if ([SANetworkConfig sharedInstance].responseCodeKey && responseData[[SANetworkConfig sharedInstance].responseCodeKey]) {
                        _responseCode = [responseData[[SANetworkConfig sharedInstance].responseCodeKey] integerValue];
                    }
                    if ([SANetworkConfig sharedInstance].responseMessageKey) {
                        _responseMessage = responseData[[SANetworkConfig sharedInstance].responseMessageKey];
                    }
                    if ([SANetworkConfig sharedInstance].responseContentDataKey) {
                        _responseContentData = responseData[[SANetworkConfig sharedInstance].responseContentDataKey];
                    }
                }
            }
                break;
            default:
                _responseMessage = [self responseMsgByNetworkStatus:networkStatus];
                break;
        }

    }
    return self;
}

- (id)fetchDataWithReformer:(id<SANetworkResponseReformerProtocol>)reformer {
    if ([reformer respondsToSelector:@selector(networkResponse:reformerDataWithOriginData:)]) {
        return [reformer networkResponse:self reformerDataWithOriginData:self.responseData];
    }
    return [self.responseData mutableCopy];
}

- (NSString *)responseMsgByNetworkStatus:(SANetworkStatus)networkStatus {
    /**
     *  @brief     若做国际化的话,因为AFNetworking的国际化文件使用的是AFNetworking.strings,这个类库又是依赖AFNetworking的。为了少创建一个 .strings 文件。这里就复用"AFNetworking"了。
     */
    switch (networkStatus) {
        case SANetworkNotReachableStatus:
            return NSLocalizedStringFromTable(@"暂无网络连接", @"AFNetworking", nil);
        case SANetworkResponseDataAuthenticationFailStatus:
            return NSLocalizedStringFromTable(@"数据验证失败", @"AFNetworking", nil);
        case SANetworkRequestParamIncorrectStatus:
            return NSLocalizedStringFromTable(@"请求参数有误", @"AFNetworking", nil);
        case SANetworkResponseFailureStatus:
            return NSLocalizedStringFromTable(@"请求数据失败", @"AFNetworking", nil);
        default:
            return nil;
    }
}

@end


text:
//
// Created by Michael Fong on 2016/11/19.
//

#ifndef LOSTINCOMPILATION_COMPONENT_H
#define LOSTINCOMPILATION_COMPONENT_H

/**
 * Each element represents for an internal component for a compiler, including
 * - Parser
 * - Analyzer
 * - Symbol Binding
 */
enum ComponentType {
    COMPONENT_PARSER,
    COMPONENT_ANALYZER,
    COMPONENT_INTEPRETER,
    COMPONENT_COMPILER,
    COMPONENT_BINDING,
    COMPONENT_UNKNOWN
};

#endif //LOSTINCOMPILATION_COMPONENT_H


text:
"""
Python environments and packages
================================

This module provides tools for using Python `virtual environments`_
and installing Python packages using the `pip`_ installer.

.. _virtual environments: http://www.virtualenv.org/
.. _pip: http://www.pip-installer.org/

"""

from contextlib import contextmanager
from distutils.version import StrictVersion as V
from pipes import quote
import os
import posixpath
import re

from fabric.api import cd, hide, prefix, run, settings, sudo
from fabric.utils import puts

from fabtools.files import is_file
from fabtools.utils import abspath, download, run_as_root

GET_PIP_URL = 'https://bootstrap.pypa.io/get-pip.py'

def is_pip_installed(version=None, pip_cmd='pip'):
    """
    Check if `pip`_ is installed.

    .. _pip: http://www.pip-installer.org/
    """
    with settings(hide('running', 'warnings', 'stderr', 'stdout'), warn_only=True):
        res = run('%(pip_cmd)s --version 2>/dev/null' % locals())
        if res.failed:
            return False
        if version is None:
            return res.succeeded
        else:
            m = re.search(r'pip (?P<version>.*) from', res)
            if m is None:
                return False
            installed = m.group('version')
            if V(installed) < V(version):
                puts("pip %s found (version >= %s required)" % (installed, version))
                return False
            else:
                return True

def install_pip(python_cmd='python', use_sudo=True):
    """
    Install the latest version of `pip`_, using the given Python
    interpreter.

    ::

        import fabtools

        if not fabtools.python.is_pip_installed():
            fabtools.python.install_pip()

    .. note::
        pip is automatically installed inside a virtualenv, so there
        is no need to install it yourself in this case.

    .. _pip: http://www.pip-installer.org/
    """

    with cd('/tmp'):

        download(GET_PIP_URL)

        command = '%(python_cmd)s get-pip.py' % locals()
        if use_sudo:
            run_as_root(command, pty=False)
        else:
            run(command, pty=False)

        run('rm -f get-pip.py')

def is_installed(package, pip_cmd='pip'):
    """
    Check if a Python package is installed (using pip).

    Package names are case insensitive.

    Example::

        from fabtools.python import virtualenv
        import fabtools

        with virtualenv('/path/to/venv'):
            fabtools.python.install('Flask')
            assert fabtools.python.is_installed('flask')

    .. _pip: http://www.pip-installer.org/
    """
    with settings(hide('running', 'stdout', 'stderr', 'warnings'), warn_only=True):
        res = run('%(pip_cmd)s freeze' % locals())
    packages = [line.split('==')[0].lower() for line in res.splitlines()]
    return (package.lower() in packages)

def install(packages, upgrade=False, download_cache=None, allow_external=None,
            allow_unverified=None, quiet=False, pip_cmd='pip', use_sudo=False,
            user=None, exists_action=None):
    """
    Install Python package(s) using `pip`_.

    Package names are case insensitive.

    Starting with version 1.5, pip no longer scrapes insecure external
    urls by default and no longer installs externally hosted files by
    default. Use ``allow_external=['foo', 'bar']`` or
    ``allow_unverified=['bar', 'baz']`` to change these behaviours
    for specific packages.

    Examples::

        import fabtools

        # Install a single package
        fabtools.python.install('package', use_sudo=True)

        # Install a list of packages
        fabtools.python.install(['pkg1', 'pkg2'], use_sudo=True)

    .. _pip: http://www.pip-installer.org/
    """
    if isinstance(packages, basestring):
        packages = [packages]

    if allow_external in (None, False):
        allow_external = []
    elif allow_external is True:
        allow_external = packages

    if allow_unverified in (None, False):
        allow_unverified = []
    elif allow_unverified is True:
        allow_unverified = packages

    options = []
    if upgrade:
        options.append('--upgrade')
    if download_cache:
        options.append('--download-cache="%s"' % download_cache)
    if quiet:
        options.append('--quiet')
    for package in allow_external:
        options.append('--allow-external="%s"' % package)
    for package in allow_unverified:
        options.append('--allow-unverified="%s"' % package)
    if exists_action:
        options.append('--exists-action=%s' % exists_action)
    options = ' '.join(options)

    packages = ' '.join(packages)

    command = '%(pip_cmd)s install %(options)s %(packages)s' % locals()

    if use_sudo:
        sudo(command, user=user, pty=False)
    else:
        run(command, pty=False)

def install_requirements(filename, upgrade=False, download_cache=None,
                         allow_external=None, allow_unverified=None,
                         quiet=False, pip_cmd='pip', use_sudo=False,
                         user=None, exists_action=None):
    """
    Install Python packages from a pip `requirements file`_.

    ::

        import fabtools

        fabtools.python.install_requirements('project/requirements.txt')

    .. _requirements file: http://www.pip-installer.org/en/latest/requirements.html
    """
    if allow_external is None:
        allow_external = []

    if allow_unverified is None:
        allow_unverified = []

    options = []
    if upgrade:
        options.append('--upgrade')
    if download_cache:
        options.append('--download-cache="%s"' % download_cache)
    for package in allow_external:
        options.append('--allow-external="%s"' % package)
    for package in allow_unverified:
        options.append('--allow-unverified="%s"' % package)
    if quiet:
        options.append('--quiet')
    if exists_action:
        options.append('--exists-action=%s' % exists_action)
    options = ' '.join(options)

    command = '%(pip_cmd)s install %(options)s -r %(filename)s' % locals()

    if use_sudo:
        sudo(command, user=user, pty=False)
    else:
        run(command, pty=False)

def create_virtualenv(directory, system_site_packages=False, venv_python=None,
               use_sudo=False, user=None, clear=False, prompt=None,
               virtualenv_cmd='virtualenv'):
    """
    Create a Python `virtual environment`_.

    ::

        import fabtools

        fabtools.python.create_virtualenv('/path/to/venv')

    .. _virtual environment: http://www.virtualenv.org/
    """
    options = ['--quiet']
    if system_site_packages:
        options.append('--system-site-packages')
    if venv_python:
        options.append('--python=%s' % quote(venv_python))
    if clear:
        options.append('--clear')
    if prompt:
        options.append('--prompt=%s' % quote(prompt))
    options = ' '.join(options)

    directory = quote(directory)

    command = '%(virtualenv_cmd)s %(options)s %(directory)s' % locals()
    if use_sudo:
        sudo(command, user=user)
    else:
        run(command)

def virtualenv_exists(directory):
    """
    Check if a Python `virtual environment`_ exists.

    .. _virtual environment: http://www.virtualenv.org/
    """
    return is_file(posixpath.join(directory, 'bin', 'python'))

@contextmanager
def virtualenv(directory, local=False):
    """
    Context manager to activate an existing Python `virtual environment`_.

    ::

        from fabric.api import run
        from fabtools.python import virtualenv

        with virtualenv('/path/to/virtualenv'):
            run('python -V')

    .. _virtual environment: http://www.virtualenv.org/
    """

    path_mod = os.path if local else posixpath

    # Build absolute path to the virtualenv activation script
    venv_path = abspath(directory, local)
    activate_path = path_mod.join(venv_path, 'bin', 'activate')

    # Source the activation script
    with prefix('. %s' % quote(activate_path)):
        yield


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
null

#### Original name
Acaulium vignoli-lutatii Matr.

### Remarks
null


text:
<?php
function admin_products(){
	//check isAdmin
	if(isAdmin()){
		//xay ra neu co hanh dong tu form xoa
		if(isPostRequest()){
			$id= $_POST['id'];

			admin_deleteProduct($id);
		}
		$data = array();
		$data['product'] = model('products')->get_product();
		$data['template_file'] = 'products/admin_sanpham.php';
		render('layout.php', $data);

	}else {
		$data['template_file'] = 'user/error.php';
		render('layout.php', $data);
	}
}

function admin_updateProduct(){

	if(isAdmin()){
		$id = $_GET['id'];
		if(isPostRequest()){
			$edit = array();
			$edit['id'] = $_POST['id'];
			$edit['name_product'] = $_POST['name'];
			$edit['price'] = $_POST['price'];
			$edit['type'] = $_POST['type'];
			$edit['description'] = $_POST['description'];
			$edit['content'] = $_POST['content_'];
		//img upload
			if($_FILES['image']['name']==NULL){
				$edit['image'] = $_POST['url-img'];

			}else{
				$edit['image'] = "styles/img/product/".$_FILES['image']['name'];
			$path = 'styles/img/product/'.$_FILES['image']['name']; // Đường dẫn chưa file upload
			move_uploaded_file($_FILES['image']['tmp_name'], $path);
		}
		//update vao co so du lieu
		$where = "`id`=$id";
		$t = db_update('products',$edit,$where);
		redirect('index.php?c=admin&m=products');
	}
	$data = array();
	$data['product'] = model('products')->get_product_byid($id);
	$data['template_file'] = 'products/update.php';
	render('layout.php', $data);

}

}

function admin_addproduct(){
	if(isAdmin()){
		if(isPostRequest()){
			$edit = array();
			$edit['id'] = $_POST['id'];
			$edit['name_product'] = $_POST['name'];
			$edit['price'] = $_POST['price'];
			$edit['type'] = $_POST['type'];
			$edit['description'] = $_POST['description'];
			$edit['content'] = $_POST['content_'];

			$edit['image'] = "styles/img/product/".$_FILES['image']['name'];
		$path = 'styles/img/product/'.$_FILES['image']['name']; // Đường dẫn chưa file upload
		move_uploaded_file($_FILES['image']['tmp_name'], $path);

		db_insert('products',$edit);
		redirect('index.php?c=admin&m=products');
	}
	$data['template_file'] = 'products/addNewProduct.php';
	render('layout.php', $data);
}

}

function admin_deleteProduct($id){

	if(isAdmin()){
		$where = "`id`=$id";
		db_delete('products',$where);
		redirect('index.php?c=admin&m=products');
	}
}

function admin_news(){

	//check isAdmin
	if(isAdmin()){
		if(isPostRequest()){
			$id= $_POST['id'];
			admin_deleteNews($id);
		}
		$data = array();
		$data = array();
		$data['news'] = model('news')->get_post();
		$data['template_file'] = 'news/admin_news.php';
		render('layout.php', $data);
	}else{
		$data['template_file'] = 'user/error.php';
		render('layout.php', $data);

	}

}

function admin_deleteNews($id){
	if(isAdmin()){
		$id = $_POST['id'];
		$where = "`ID`=$id";
		db_delete('news',$where);
		redirect('index.php?c=admin&m=news');
	}

}

function admin_updateNews(){

	if(isAdmin()){
		$id = $_GET['id'];
		if(isPostRequest()){

			$edit = array();
			$edit['ID'] = $_POST['ID'];
			$edit['title'] = $_POST['title'];
			$edit['author'] = $_POST['author'];
			$edit['content'] = $_POST['content_'];
			$edit['time'] = date("Y-m-d H:i:s");
			$edit['slogan'] = $_POST['slogan'];
			$edit['tag'] = $_POST['tag'];
			//xoa bang post_tag where id=idpost
			$temp_ = $_POST['ID'];
			$where_ = "`post_id`=$temp_";

			db_delete('post_tag',$where_);
			$t = model('news')->add_tag($_POST['ID'],$_POST['tag']);

			//upload image
			if($_FILES['image']['name']==NULL){
				$edit['figimage'] = $_POST['img-url'];
			}else{
			$path = 'styles/img/news/'.$_FILES['image']['name']; // Đường dẫn chưa file upload
			move_uploaded_file($_FILES['image']['tmp_name'], $path);
			$edit['figimage'] = "styles/img/news/".$_FILES['image']['name'];
		}

		//update vao co so du lieu
		$where = "`ID`= $id";
		//var_dump($where);die();
		$t = db_update('news',$edit,$where);
		redirect('index.php?c=news&m=mainpage');
	}

	$data['news'] = model('news')->get_detail($id);
	$data['template_file'] = 'news/update.php';
	render('layout.php', $data);
}
}
function admin_addnews(){

	if(isAdmin()){
		if(isPostRequest()){
			$edit = array();
			$edit['ID'] = $_POST['ID'];
			$edit['title'] = $_POST['title'];
			$edit['author'] = $_POST['author'];
			$edit['content'] = $_POST['content_'];
			$edit['time'] = date('yy-mm-dd h:i:s');
			$edit['slogan'] = $_POST['slogan'];
			$edit['tag'] = $_POST['tag'];

		//goi ham xu li tag
			$t = model('news')->add_tag($_POST['ID'],$_POST['tag']);
		//upload image

			$path = 'styles/img/news/'.$_FILES['image']['name']; // Đường dẫn chưa file upload
			move_uploaded_file($_FILES['image']['tmp_name'], $path);
			$edit['figimage'] = "styles/img/news/".$_FILES['image']['name'];
			db_insert('news',$edit);
			redirect('index.php?c=news&m=mainpage');
		}

		$data['template_file'] = 'news/addNews.php';
		render('layout.php', $data);
	}

}
function admin_checkoutView(){
	if(isAdmin()){
		$data['checkout'] = model('checkout')->get_bill();
		$data['template_file'] = 'products/view_checkout.php';
		render('layout.php', $data);
	}
}
function admin_checkout_add(){
	if(isset($_POST['submit'])){
		date_default_timezone_set('Asia/Ho_Chi_Minh');
	 	$date1 = date("Y-m-d H:i:s");

    $temp = array();
    $temp['name_customer'] = $_POST['name_customer'];
    $temp['email'] = $_POST['email'];
    $temp['phone'] = $_POST['phone'];
    $temp['bank'] = $_POST['bank'];
    $temp['time'] = $date1;
    $temp['payed'] =false;
    $temp['deliveried'] = false;
 	$temp['total'] = $_SESSION['total'];

 	db_insert('checkout',$temp);
 	//tru bot so luong cua san pham
 	foreach ($_SESSION['cart'] as $key => $value) {
 		//truy van toi san pham trong csdl
 		$where = "`id`=$key";

 		$result = model('products')->get_product_byid($key);
 		$result[0]['status'] = $result[0]['status'] - $value['qty'];

 		db_update('products',$result[0],$where);
 	}

 	$data['cart'] = model('products')->get_product_session();
    $data['bill'] = $temp;
    $data['template_file'] = 'products/paybill.php';
    render('layout.php', $data);
    unset($_SESSION['cart']);
  }
  elseif(isset($_SESSION['cart'])){
    $data['cart'] = model('products')->get_product_session();
    $data['template_file'] = 'products/checkout.php';
    render('layout.php', $data);

  }
}

?>


text:
class CreateSurveyEssayAnswers < ActiveRecord::Migration
  def change
    create_table :survey_essay_answers do |t|
      t.integer   :user_course_id
      t.integer   :question_id
      t.text      :text

      t.time      :deleted_at
      t.timestamps
    end
  end
end


text:
package com.google.sps.objects;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashSet;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;
import com.google.common.collect.ImmutableMap;
import com.google.sps.Objects.Comment;
import com.google.sps.Objects.Post;
import com.google.sps.Objects.User;
import com.google.sps.Objects.Badge;

/** Unit tests for Post. */
public class PostTest {

  private static final String POST_TEXT = "a great post";
  private static final String CHALLENGE_NAME = "run 4 miles";
  private static final String IMG = "";
  private static final long TIMESTAMP = 123123123;
  private static final long POST_ID = 4324344;
  private static final String USER_EMAIL = "test@mctest.com";
  private static final String USER_ID = "testy-mc-test";

  private final LocalServiceTestHelper helper =
      new LocalServiceTestHelper(
              new LocalDatastoreServiceTestConfig()
                  .setDefaultHighRepJobPolicyUnappliedJobPercentage(0),
              new LocalUserServiceTestConfig())
          .setEnvEmail(USER_EMAIL)
          .setEnvIsLoggedIn(true)
          .setEnvAuthDomain("gmail.com")
          .setEnvAttributes(
              new HashMap(
                  ImmutableMap.of(
                      "com.google.appengine.api.users.UserService.user_id_key", USER_ID)));

  private static final User CURRENT_USER =
      new User(
          USER_ID,
          "Test",
          "McTest",
          USER_EMAIL,
          /* phoneNumber= */ "123-456-7890",
          /* profilePic= */ "",
          /* address= */ "",
          /* latitude= */ 0,
          /* longitude= */ 0,
          /* badges= */ new LinkedHashSet<Badge>(),
          /* groups= */ new LinkedHashSet<Long>(),
          /* interests= */ new ArrayList<String>());

  private Post post;
  private DatastoreService datastore;

  @Before
  public void setUp() {
    helper.setUp();
    datastore = DatastoreServiceFactory.getDatastoreService();
    datastore.put(CURRENT_USER.toEntity());
    post =
        new Post(
            /* postId */ POST_ID,
            /* authorId */ USER_ID,
            /* authorName */ "TEST USER",
            /* authorPic */ "",
            /* postText */ POST_TEXT,
            /* comments */ new ArrayList<Comment>(),
            /* challengeName */ CHALLENGE_NAME,
            /* timestamp */ TIMESTAMP,
            /* img */ IMG,
            /* likes */ new HashSet<String>());
  }

  @After
  public void tearDown() {
    helper.tearDown();
    post = null;
  }

  @Test
  public void getPostTextTest() {
    assertEquals(post.getPostText(), POST_TEXT);
  }

  @Test
  public void getImgtTest() {
    assertEquals(post.getImg(), IMG);
  }

  @Test
  public void getChallengeNameTest() {
    assertEquals(post.getChallengeName(), CHALLENGE_NAME);
  }

  @Test
  public void getCommentsTest() {
    assertEquals(post.getComments().size(), 0);
  }

  @Test
  public void getLikesTest() {
    assertEquals(post.getLikes().size(), 0);
    post.addLike("user 1");
    post.addLike("user 2");
    HashSet<String> testLikes = new HashSet<String>();
    testLikes.add("user 1");
    testLikes.add("user 2");

    assertEquals(testLikes, post.getLikes());
  }

  @Test
  public void addCommentTest() {
    Comment testComment1 =
        new Comment(
            4324344, /* userId */
            "a great comment", /* commentText */
            "123123123", /* userId */
            "" /* userProfilePic */);
    Comment testComment2 =
        new Comment(
            55555555, /* userId */
            "another great comment", /* commentText */
            "09090909" /* userId */,
            "" /* userProfilePic */);
    post.addComment(testComment1);
    post.addComment(testComment2);

    assertEquals(post.getComments().size(), 2);
    assertTrue(equalCommentCheck(post.getComments().get(0), testComment1));
    assertTrue(equalCommentCheck(post.getComments().get(1), testComment2));
  }

  public boolean equalCommentCheck(Comment comment1, Comment comment2) {
    if (!(comment1 instanceof Comment) || !(comment2 instanceof Comment)) {
      return false;
    }
    return comment1.getCommentText().equals(comment2.getCommentText())
        && comment1.getUser().equals(comment2.getUser());
  }

  @Test
  public void addLikeTest() {
    post.addLike("user 1");
    post.addLike("user 2");
    HashSet<String> likes = post.getLikes();

    assertEquals(likes.size(), 2);
    assertTrue(likes.contains("user 1"));
    assertTrue(likes.contains("user 2"));
  }

  @Test
  public void removeLikeOnceTest() {
    post.addLike("test user 1");
    HashSet<String> likes = post.getLikes();
    assertEquals(likes.size(), 1);

    post.removeLike("test user 1");

    likes = post.getLikes();
    assertEquals(likes.size(), 0);
  }

  @Test
  public void removeLikeMultipleTest() {
    post.addLike("test user 1");
    post.addLike("test user 2");
    HashSet<String> likes = post.getLikes();
    assertEquals(likes.size(), 2);

    post.removeLike("test user 1");
    likes = post.getLikes();
    assertEquals(likes.size(), 1);
    assertTrue(likes.contains("test user 2"));
  }

  @Test
  public void toAndFromPostEntityTest() throws Exception {
    Entity entity = post.toEntity();
    Post returnedPost = Post.fromEntity(entity);

    assertTrue(returnedPost.equals(post));
  }
}


text:
:loop
labview-cli -v "LargeOutput.exe" -- 10000
if %errorlevel% == 0 goto :loop


text:
#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MAIN

#include <vector>

#include <boost/bind/bind.hpp>
using namespace boost::placeholders;

#include <boost/make_shared.hpp>
#include <memory>
#include <boost/test/unit_test.hpp>
#include <boost/test/tools/floating_point_comparison.hpp>

#include <Eigen/Core>

#include "tudat/basics/testMacros.h"

#include "tudat/astro/basic_astro/accelerationModel.h"
#include "tudat/astro/basic_astro/testAccelerationModels.h"
#include "tudat/astro/basic_astro/testBody.h"
#include "tudat/basics/basicTypedefs.h"

namespace tudat
{
namespace unit_tests
{

using basic_astrodynamics::AccelerationModel;
using basic_astrodynamics::updateAndGetAcceleration;

BOOST_AUTO_TEST_SUITE( test_accelerationModel )

//! Test whether DerivedAccelerationModel (acceleration data type=Eigen::Vector3d) functions
//! correctly.
BOOST_AUTO_TEST_CASE( test_derived3dAccelerationModel )
{
    using basic_astrodynamics::AccelerationModel3dPointer;

    // Shortcuts.
    typedef TestBody< 3, double > TestBody3d;
    typedef std::shared_ptr< TestBody3d > TestBody3dPointer;
    typedef DerivedAccelerationModel< > DerivedAccelerationModel3d;

    // Create body with initial state and time.
    TestBody3dPointer body = std::make_shared< TestBody3d >(
                ( Eigen::Vector6d( ) << 1.1, 2.2, 3.3, -0.1, 0.2, 0.3 ).finished( ), 2.0 );

    // Create acceleration model using DerivedAccelerationModel class, and pass pointers to
    // functions in body.
    AccelerationModel3dPointer accelerationModel3d
            = std::make_shared< DerivedAccelerationModel3d >(
                std::bind( &TestBody3d::getCurrentPosition, body ),
                std::bind( &TestBody3d::getCurrentTime, body ) );

    // Declare container of computed accelerations.
    std::vector< Eigen::Vector3d > computedAccelerations( 3 );

    // Get acceleration vector before members are updated.
    computedAccelerations.at( 0 ) = accelerationModel3d->getAcceleration( );

    // Update time and state.
    body->setCurrentTimeAndState(
                -1.1, ( Eigen::Vector6d( )
                        << -0.45, 10.63, -9.81, 0.11, 0.22, 0.33 ).finished( ) );

    // Update acceleration model members.
    accelerationModel3d->updateMembers( );

    // Get acceleration vector, now after members have been updated.
    computedAccelerations.at( 1 ) = accelerationModel3d->getAcceleration( );

    // Update time and state.
    body->setCurrentTimeAndState(
                4.6, ( Eigen::Vector6d( )
                       << -87.685, 101.44, -1.38, -0.12, 0.23, -0.34 ).finished( ) );

    // Update and get acceleration with single function.
    computedAccelerations.at( 2 ) = updateAndGetAcceleration( accelerationModel3d );

    // Set expected accelerations.
    std::vector< Eigen::Vector3d > expectedAccelerations;
    expectedAccelerations.push_back( Eigen::Vector3d(   1.1,     2.2,   3.3  ) / (  2.0 *  2.0 ) );
    expectedAccelerations.push_back( Eigen::Vector3d(  -0.45,   10.63, -9.81 ) / ( -1.1 * -1.1 ) );
    expectedAccelerations.push_back( Eigen::Vector3d( -87.685, 101.44, -1.38 ) / (  4.6 *  4.6 ) );

    // Check that the acceleration vectors before and after the update match expected values.
    for ( unsigned int i = 0; i < computedAccelerations.size( ); i++ )
    {
        TUDAT_CHECK_MATRIX_BASE( computedAccelerations.at( i ), expectedAccelerations.at( i ) )
                BOOST_CHECK_CLOSE_FRACTION( computedAccelerations.at( i ).coeff( row, col ),
                                   expectedAccelerations.at( i ).coeff( row, col ), 5.0e-15 );
    }
}

////! Test whether DerivedAccelerationModel (acceleration data type=Eigen::Vector1i) functions
////! correctly.
//BOOST_AUTO_TEST_CASE( test_derived1iAccelerationModel )
//{
//    // Shortcuts.
//    typedef TestBody< 1, int > TestBody1i;
//    typedef std::shared_ptr< TestBody1i > TestBody1iPointer;
//    typedef AccelerationModel< int > AccelerationModel1i;
//    typedef std::shared_ptr< AccelerationModel1i > AccelerationModel1iPointer;
//    typedef DerivedAccelerationModel< int, int, int > DerivedAccelerationModel1i;

//    // Create body with initial state and time.
//    TestBody1iPointer body = std::make_shared< TestBody1i >( Eigen::Vector2i( 20, 1 ), 2 );

//    // Create acceleration model using DerivedAccelerationModel class, and pass pointers to
//    // functions in body.
//    AccelerationModel1iPointer accelerationModeli1
//            = std::make_shared< DerivedAccelerationModel1i >(
//                std::bind( ( &TestBody1i::getCurrentPosition ), body ),
//                std::bind( ( &TestBody1i::getCurrentTime ), body ) );

//    // Declare container of computed accelerations.
//    std::vector< int > computedAccelerations( 3 );

//    // Get scalar acceleration before members are updated.
//    computedAccelerations.at( 0 ) = accelerationModeli1->getAcceleration( );

//    // Update time and state.
//    body->setCurrentTimeAndState( -3, Eigen::Vector2i( 90, 3 ) );

//    // Update acceleration model members.
//    accelerationModeli1->updateMembers( );

//    // Get scalar acceleration, now after members have been updated.
//    computedAccelerations.at( 1 ) = accelerationModeli1->getAcceleration( );

//    // Update time and state.
//    body->setCurrentTimeAndState( 4, Eigen::Vector2i( 16, -4 ) );

//    // Update and get scalar acceleration with single function.
//    computedAccelerations.at( 2 ) = updateAndGetAcceleration( accelerationModeli1 );

//    // Set expected accelerations.
//    const std::vector< int > expectedAccelerations = { 20 / ( 2 * 2 ), 90 / ( -3 * -3 ), 16 / ( 4 * 4 ) };

//    // Check that the acceleration vectors before and after the update match expected values.
//    for ( unsigned int i = 0; i < computedAccelerations.size( ); i++ )
//    {
//        BOOST_CHECK_EQUAL( computedAccelerations.at( i ), expectedAccelerations.at( i ) );
//    }
//}

BOOST_AUTO_TEST_SUITE_END( )

} // namespace unit_tests
} // namespace tudat


text:
namespace OpenLiveWriter.Interop.Windows
{

	/// <summary>
	/// Error codes that can be returned from Win32 functions
	/// Use kernel32 GetLastError() to get the last error on the thread
	/// </summary>
	public struct ERROR
	{
		public const int SUCCESS = 0 ;
		public const int FILE_NOT_FOUND = 2;
		public const int NO_MORE_FILES = 18;
		public const int INSUFFICIENT_BUFFER  = 122;
		public const int PROC_NOT_FOUND = 127 ;
		public const int ALREADY_EXISTS = 183 ;
		public const int MORE_DATA = 234 ;

		#region registry-related errors

		//  The configuration registry database is corrupt.
		public const int BADDB = 1009 ;

		//  The configuration registry key is invalid.
		public const int BADKEY = 1010 ;

		//  The configuration registry key could not be opened.
		public const int CANTOPEN = 1011 ;

		//  The configuration registry key could not be read.
		public const int CANTREAD = 1012 ;

		//  The configuration registry key could not be written.
		public const int CANTWRITE = 1013 ;

		//  One of the files in the registry database had to be recovered by use of a log or alternate copy. The recovery was successful.
		public const int REGISTRY_RECOVERED = 1014 ;

		//  The registry is corrupted. The structure of one of the files containing registry data is corrupted, or the system's memory image of the file is corrupted, or the file could not be recovered because the alternate copy or log was absent or corrupted.
		public const int REGISTRY_CORRUPT = 1015 ;

		//  An I/O operation initiated by the registry failed unrecoverably. The registry could not read in, or write out, or flush, one of the files that contain the system's image of the registry.
		public const int REGISTRY_IO_FAILED = 1016 ;

		//  The system has attempted to load or restore a file into the registry, but the specified file is not in a registry file format.
		public const int NOT_REGISTRY_FILE = 1017 ;

		//  Illegal operation attempted on a registry key that has been marked for deletion.
		public const int KEY_DELETED = 1018 ;

		//  System could not allocate the required space in a registry log.
		public const int NO_LOG_SPACE = 1019 ;

		//  Cannot create a symbolic link in a registry key that already has subkeys or values.
		public const int KEY_HAS_CHILDREN = 1020 ;

		//  Cannot create a stable subkey under a volatile parent key.
		public const int CHILD_MUST_BE_VOLATILE = 1021 ;

		//  A notify change request is being completed and the information is not being returned in the caller's buffer. The caller now needs to enumerate the files to find the changes.
		public const int NOTIFY_ENUM_DIR = 1022 ;

		#endregion

		public const int NO_ASSOCIATION = 1155 ;
		public const int UNABLE_TO_REMOVE_REPLACED = 1175 ;
		public const int UNABLE_TO_MOVE_REPLACEMENT = 1176 ;
		public const int UNABLE_TO_MOVE_REPLACEMENT_2 = 1177 ;
		public const int BAD_DEVICE = 1200 ;
		public const int NO_NET_OR_BAD_PATH = 1203 ;
		public const int HOTKEY_ALREADY_REGISTERED = 1409 ;
		public const int CONNECTION_RESET = 10054;
		public const int CONNECTION_REFUSED = 10061;
		public const int NOT_CONNECTED = 2250 ;
	}
}


text:
/**
 * @author Jacky Nguyen <jacky@sencha.com>
 * @docauthor Jacky Nguyen <jacky@sencha.com>
 * @class Ext.Class
 *
 * Handles class creation throughout the framework. This is a low level factory that is used by Ext.ClassManager and generally
 * should not be used directly. If you choose to use Ext.Class you will lose out on the namespace, aliasing and depency loading
 * features made available by Ext.ClassManager. The only time you would use Ext.Class directly is to create an anonymous class.
 *
 * If you wish to create a class you should use {@link Ext#define Ext.define} which aliases
 * {@link Ext.ClassManager#create Ext.ClassManager.create} to enable namespacing and dynamic dependency resolution.
 *
 * Ext.Class is the factory and **not** the superclass of everything. For the base class that **all** Ext classes inherit
 * from, see {@link Ext.Base}.
 */
(function() {
    var ExtClass,
        Base = Ext.Base,
        baseStaticMembers = [],
        baseStaticMember, baseStaticMemberLength;

    for (baseStaticMember in Base) {
        if (Base.hasOwnProperty(baseStaticMember)) {
            baseStaticMembers.push(baseStaticMember);
        }
    }

    baseStaticMemberLength = baseStaticMembers.length;

    // Creates a constructor that has nothing extra in its scope chain.
    function makeCtor (className) {
        function constructor () {
            // Opera has some problems returning from a constructor when Dragonfly isn't running. The || null seems to
            // be sufficient to stop it misbehaving. Known to be required against 10.53, 11.51 and 11.61.
            return this.constructor.apply(this, arguments) || null;
        }
        //<debug>
        if (className) {
            constructor.displayName = className;
        }
        //</debug>
        return constructor;
    }

    /**
     * @method constructor
     * Create a new anonymous class.
     *
     * @param {Object} data An object represent the properties of this class
     * @param {Function} onCreated Optional, the callback function to be executed when this class is fully created.
     * Note that the creation process can be asynchronous depending on the pre-processors used.
     *
     * @return {Ext.Base} The newly created class
     */
    Ext.Class = ExtClass = function(Class, data, onCreated) {
        if (typeof Class != 'function') {
            onCreated = data;
            data = Class;
            Class = null;
        }

        if (!data) {
            data = {};
        }

        Class = ExtClass.create(Class, data);

        ExtClass.process(Class, data, onCreated);

        return Class;
    };

    Ext.apply(ExtClass, {
        /**
         * @private
         * @param Class
         * @param data
         * @param hooks
         */
        onBeforeCreated: function(Class, data, hooks) {
            Class.addMembers(data);

            hooks.onCreated.call(Class, Class);
        },

        /**
         * @private
         * @param Class
         * @param classData
         * @param onClassCreated
         */
        create: function(Class, data) {
            var name, i;

            if (!Class) {
                // This "helped" a bit in IE8 when we create 450k instances (3400ms->2700ms),
                // but removes some flexibility as a result because overrides cannot override
                // the constructor method... kept in case we want to reconsider because it is
                // more involved than just use the pass 'constructor'
                //
                //if (data.hasOwnProperty('constructor')) {
                //    Class = data.constructor;
                //    delete data.constructor;
                //    Class.$owner = Class;
                //    Class.$name = 'constructor';
                //} else {
                Class = makeCtor(
                    //<debug>
                    data.$className
                    //</debug>
                );
                //}
            }

            for (i = 0; i < baseStaticMemberLength; i++) {
                name = baseStaticMembers[i];
                Class[name] = Base[name];
            }

            return Class;
        },

        /**
         * @private
         * @param Class
         * @param data
         * @param onCreated
         */
        process: function(Class, data, onCreated) {
            var preprocessorStack = data.preprocessors || ExtClass.defaultPreprocessors,
                registeredPreprocessors = this.preprocessors,
                hooks = {
                    onBeforeCreated: this.onBeforeCreated
                },
                preprocessors = [],
                preprocessor, preprocessorsProperties,
                i, ln, j, subLn, preprocessorProperty, process;

            delete data.preprocessors;

            for (i = 0,ln = preprocessorStack.length; i < ln; i++) {
                preprocessor = preprocessorStack[i];

                if (typeof preprocessor == 'string') {
                    preprocessor = registeredPreprocessors[preprocessor];
                    preprocessorsProperties = preprocessor.properties;

                    if (preprocessorsProperties === true) {
                        preprocessors.push(preprocessor.fn);
                    }
                    else if (preprocessorsProperties) {
                        for (j = 0,subLn = preprocessorsProperties.length; j < subLn; j++) {
                            preprocessorProperty = preprocessorsProperties[j];

                            if (data.hasOwnProperty(preprocessorProperty)) {
                                preprocessors.push(preprocessor.fn);
                                break;
                            }
                        }
                    }
                }
                else {
                    preprocessors.push(preprocessor);
                }
            }

            hooks.onCreated = onCreated ? onCreated : Ext.emptyFn;
            hooks.preprocessors = preprocessors;

            this.doProcess(Class, data, hooks);
        },

        doProcess: function(Class, data, hooks){
            var me = this,
                preprocessor = hooks.preprocessors.shift();

            if (!preprocessor) {
                hooks.onBeforeCreated.apply(me, arguments);
                return;
            }

            if (preprocessor.call(me, Class, data, hooks, me.doProcess) !== false) {
                me.doProcess(Class, data, hooks);
            }
        },

        /** @private */
        preprocessors: {},

        /**
         * Register a new pre-processor to be used during the class creation process
         *
         * @param {String} name The pre-processor's name
         * @param {Function} fn The callback function to be executed. Typical format:
         *
         *     function(cls, data, fn) {
         *         // Your code here
         *
         *         // Execute this when the processing is finished.
         *         // Asynchronous processing is perfectly ok
         *         if (fn) {
         *             fn.call(this, cls, data);
         *         }
         *     });
         *
         * @param {Function} fn.cls The created class
         * @param {Object} fn.data The set of properties passed in {@link Ext.Class} constructor
         * @param {Function} fn.fn The callback function that **must** to be executed when this
         * pre-processor finishes, regardless of whether the processing is synchronous or aynchronous.
         * @return {Ext.Class} this
         * @private
         * @static
         */
        registerPreprocessor: function(name, fn, properties, position, relativeTo) {
            if (!position) {
                position = 'last';
            }

            if (!properties) {
                properties = [name];
            }

            this.preprocessors[name] = {
                name: name,
                properties: properties || false,
                fn: fn
            };

            this.setDefaultPreprocessorPosition(name, position, relativeTo);

            return this;
        },

        /**
         * Retrieve a pre-processor callback function by its name, which has been registered before
         *
         * @param {String} name
         * @return {Function} preprocessor
         * @private
         * @static
         */
        getPreprocessor: function(name) {
            return this.preprocessors[name];
        },

        /**
         * @private
         */
        getPreprocessors: function() {
            return this.preprocessors;
        },

        /**
         * @private
         */
        defaultPreprocessors: [],

        /**
         * Retrieve the array stack of default pre-processors
         * @return {Function[]} defaultPreprocessors
         * @private
         * @static
         */
        getDefaultPreprocessors: function() {
            return this.defaultPreprocessors;
        },

        /**
         * Set the default array stack of default pre-processors
         *
         * @private
         * @param {Array} preprocessors
         * @return {Ext.Class} this
         * @static
         */
        setDefaultPreprocessors: function(preprocessors) {
            this.defaultPreprocessors = Ext.Array.from(preprocessors);

            return this;
        },

        /**
         * Insert this pre-processor at a specific position in the stack, optionally relative to
         * any existing pre-processor. For example:
         *
         *     Ext.Class.registerPreprocessor('debug', function(cls, data, fn) {
         *         // Your code here
         *
         *         if (fn) {
         *             fn.call(this, cls, data);
         *         }
         *     }).setDefaultPreprocessorPosition('debug', 'last');
         *
         * @private
         * @param {String} name The pre-processor name. Note that it needs to be registered with
         * {@link Ext#registerPreprocessor registerPreprocessor} before this
         * @param {String} offset The insertion position. Four possible values are:
         * 'first', 'last', or: 'before', 'after' (relative to the name provided in the third argument)
         * @param {String} relativeName
         * @return {Ext.Class} this
         * @static
         */
        setDefaultPreprocessorPosition: function(name, offset, relativeName) {
            var defaultPreprocessors = this.defaultPreprocessors,
                index;

            if (typeof offset == 'string') {
                if (offset === 'first') {
                    defaultPreprocessors.unshift(name);

                    return this;
                }
                else if (offset === 'last') {
                    defaultPreprocessors.push(name);

                    return this;
                }

                offset = (offset === 'after') ? 1 : -1;
            }

            index = Ext.Array.indexOf(defaultPreprocessors, relativeName);

            if (index !== -1) {
                Ext.Array.splice(defaultPreprocessors, Math.max(0, index + offset), 0, name);
            }

            return this;
        },

        configNameCache: {},

        getConfigNameMap: function(name) {
            var cache = this.configNameCache,
                map = cache[name],
                capitalizedName;

            if (!map) {
                capitalizedName = name.charAt(0).toUpperCase() + name.substr(1);

                map = cache[name] = {
                    internal: name,
                    initialized: '_is' + capitalizedName + 'Initialized',
                    apply: 'apply' + capitalizedName,
                    update: 'update' + capitalizedName,
                    'set': 'set' + capitalizedName,
                    'get': 'get' + capitalizedName,
                    doSet : 'doSet' + capitalizedName,
                    changeEvent: name.toLowerCase() + 'change'
                };
            }

            return map;
        }
    });

    /**
     * @cfg {String} extend
     * The parent class that this class extends. For example:
     *
     *     Ext.define('Person', {
     *         say: function(text) { alert(text); }
     *     });
     *
     *     Ext.define('Developer', {
     *         extend: 'Person',
     *         say: function(text) { this.callParent(["print "+text]); }
     *     });
     */
    ExtClass.registerPreprocessor('extend', function(Class, data) {
        var Base = Ext.Base,
            basePrototype = Base.prototype,
            extend = data.extend,
            Parent, parentPrototype, i;

        delete data.extend;

        if (extend && extend !== Object) {
            Parent = extend;
        }
        else {
            Parent = Base;
        }

        parentPrototype = Parent.prototype;

        if (!Parent.$isClass) {
            for (i in basePrototype) {
                if (!parentPrototype[i]) {
                    parentPrototype[i] = basePrototype[i];
                }
            }
        }

        Class.extend(Parent);

        Class.triggerExtended.apply(Class, arguments);

        if (data.onClassExtended) {
            Class.onExtended(data.onClassExtended);
            delete data.onClassExtended;
        }

    }, true);

    //<feature classSystem.statics>
    /**
     * @cfg {Object} statics
     * List of static methods for this class. For example:
     *
     *     Ext.define('Computer', {
     *          statics: {
     *              factory: function(brand) {
     *                  // 'this' in static methods refer to the class itself
     *                  return new this(brand);
     *              }
     *          },
     *
     *          constructor: function() { ... }
     *     });
     *
     *     var dellComputer = Computer.factory('Dell');
     */
    ExtClass.registerPreprocessor('statics', function(Class, data) {
        Class.addStatics(data.statics);

        delete data.statics;
    });
    //</feature>

    //<feature classSystem.inheritableStatics>
    /**
     * @cfg {Object} inheritableStatics
     * List of inheritable static methods for this class.
     * Otherwise just like {@link #statics} but subclasses inherit these methods.
     */
    ExtClass.registerPreprocessor('inheritableStatics', function(Class, data) {
        Class.addInheritableStatics(data.inheritableStatics);

        delete data.inheritableStatics;
    });
    //</feature>

    //<feature classSystem.config>
    /**
     * @cfg {Object} config
     * List of configuration options with their default values, for which automatically
     * accessor methods are generated.  For example:
     *
     *     Ext.define('SmartPhone', {
     *          config: {
     *              hasTouchScreen: false,
     *              operatingSystem: 'Other',
     *              price: 500
     *          },
     *          constructor: function(cfg) {
     *              this.initConfig(cfg);
     *          }
     *     });
     *
     *     var iPhone = new SmartPhone({
     *          hasTouchScreen: true,
     *          operatingSystem: 'iOS'
     *     });
     *
     *     iPhone.getPrice(); // 500;
     *     iPhone.getOperatingSystem(); // 'iOS'
     *     iPhone.getHasTouchScreen(); // true;
     */
    ExtClass.registerPreprocessor('config', function(Class, data) {
        var config = data.config,
            prototype = Class.prototype;

        delete data.config;

        Ext.Object.each(config, function(name, value) {
            var nameMap = ExtClass.getConfigNameMap(name),
                internalName = nameMap.internal,
                initializedName = nameMap.initialized,
                applyName = nameMap.apply,
                updateName = nameMap.update,
                setName = nameMap.set,
                getName = nameMap.get,
                hasOwnSetter = (setName in prototype) || data.hasOwnProperty(setName),
                hasOwnApplier = (applyName in prototype) || data.hasOwnProperty(applyName),
                hasOwnUpdater = (updateName in prototype) || data.hasOwnProperty(updateName),
                optimizedGetter, customGetter;

            if (value === null || (!hasOwnSetter && !hasOwnApplier && !hasOwnUpdater)) {
                prototype[internalName] = value;
                prototype[initializedName] = true;
            }
            else {
                prototype[initializedName] = false;
            }

            if (!hasOwnSetter) {
                data[setName] = function(value) {
                    var oldValue = this[internalName],
                        applier = this[applyName],
                        updater = this[updateName];

                    if (!this[initializedName]) {
                        this[initializedName] = true;
                    }

                    if (applier) {
                        value = applier.call(this, value, oldValue);
                    }

                    if (typeof value != 'undefined') {
                        this[internalName] = value;

                        if (updater && value !== oldValue) {
                            updater.call(this, value, oldValue);
                        }
                    }

                    return this;
                };
            }

            if (!(getName in prototype) || data.hasOwnProperty(getName)) {
                customGetter = data[getName] || false;

                if (customGetter) {
                    optimizedGetter = function() {
                        return customGetter.apply(this, arguments);
                    };
                }
                else {
                    optimizedGetter = function() {
                        return this[internalName];
                    };
                }

                data[getName] = function() {
                    var currentGetter;

                    if (!this[initializedName]) {
                        this[initializedName] = true;
                        this[setName](this.config[name]);
                    }

                    currentGetter = this[getName];

                    if ('$previous' in currentGetter) {
                        currentGetter.$previous = optimizedGetter;
                    }
                    else {
                        this[getName] = optimizedGetter;
                    }

                    return optimizedGetter.apply(this, arguments);
                };
            }
        });

        Class.addConfig(config, true);
    });
    //</feature>

    //<feature classSystem.mixins>
    /**
     * @cfg {String[]/Object} mixins
     * List of classes to mix into this class. For example:
     *
     *     Ext.define('CanSing', {
     *          sing: function() {
     *              alert("I'm on the highway to hell...")
     *          }
     *     });
     *
     *     Ext.define('Musician', {
     *          mixins: ['CanSing']
     *     })
     *
     * In this case the Musician class will get a `sing` method from CanSing mixin.
     *
     * But what if the Musician already has a `sing` method? Or you want to mix
     * in two classes, both of which define `sing`?  In such a cases it's good
     * to define mixins as an object, where you assign a name to each mixin:
     *
     *     Ext.define('Musician', {
     *          mixins: {
     *              canSing: 'CanSing'
     *          },
     *
     *          sing: function() {
     *              // delegate singing operation to mixin
     *              this.mixins.canSing.sing.call(this);
     *          }
     *     })
     *
     * In this case the `sing` method of Musician will overwrite the
     * mixed in `sing` method. But you can access the original mixed in method
     * through special `mixins` property.
     */
    ExtClass.registerPreprocessor('mixins', function(Class, data, hooks) {
        var mixins = data.mixins,
            name, mixin, i, ln;

        delete data.mixins;

        Ext.Function.interceptBefore(hooks, 'onCreated', function() {
            if (mixins instanceof Array) {
                for (i = 0,ln = mixins.length; i < ln; i++) {
                    mixin = mixins[i];
                    name = mixin.prototype.mixinId || mixin.$className;

                    Class.mixin(name, mixin);
                }
            }
            else {
                for (var mixinName in mixins) {
                    if (mixins.hasOwnProperty(mixinName)) {
                        Class.mixin(mixinName, mixins[mixinName]);
                    }
                }
            }
        });
    });
    //</feature>

    //<feature classSystem.backwardsCompatible>
    // Backwards compatible
    Ext.extend = function(Class, Parent, members) {
        if (arguments.length === 2 && Ext.isObject(Parent)) {
            members = Parent;
            Parent = Class;
            Class = null;
        }

        var cls;

        if (!Parent) {
            throw new Error("[Ext.extend] Attempting to extend from a class which has not been loaded on the page.");
        }

        members.extend = Parent;
        members.preprocessors = [
            'extend'
            //<feature classSystem.statics>
            ,'statics'
            //</feature>
            //<feature classSystem.inheritableStatics>
            ,'inheritableStatics'
            //</feature>
            //<feature classSystem.mixins>
            ,'mixins'
            //</feature>
            //<feature classSystem.config>
            ,'config'
            //</feature>
        ];

        if (Class) {
            cls = new ExtClass(Class, members);
        }
        else {
            cls = new ExtClass(members);
        }

        cls.prototype.override = function(o) {
            for (var m in o) {
                if (o.hasOwnProperty(m)) {
                    this[m] = o[m];
                }
            }
        };

        return cls;
    };
    //</feature>

}());


text:
package de.jungblut.graph.mapreduce;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

public class TextGraphMapper extends
        Mapper<LongWritable, Text, LongWritable, VertexWritable> {

    @Override
    protected void map(LongWritable key, Text value, Context context)
            throws IOException, InterruptedException {

        VertexWritable vertex = new VertexWritable();
        LongWritable realKey = null;
        String[] values = value.toString().split("\t");
        int currentCount = 0;
        for (String s : values) {
            if (currentCount == 0) {
                realKey = new LongWritable(Long.parseLong(s));
                vertex.checkAndSetMinimalVertex(realKey);
                vertex.addVertex(realKey);
            } else {
                LongWritable temp = new LongWritable(Long.parseLong(s));
                vertex.checkAndSetMinimalVertex(temp);
                vertex.addVertex(temp);
            }
            currentCount++;
        }

        context.write(realKey, vertex);

        for (LongWritable edge : vertex.getEdges()) {
            context.write(edge, vertex.makeMessage());
        }
    }

}


text:
import React, {useState} from "react";
import moment from 'moment';
import hash from 'object-hash';

const useSortableProblemsData = (initialItems) => {
    const initialConfig = {key: 'identifier', direction: 'ascending'};
    const [sortConfig, setSortConfig] = React.useState(initialConfig);
    const [currentItems, setCurrentItems] = useState(initialItems);

    const getClassNamesFor = (name) => {
        if (!sortConfig) return;
        return sortConfig.key === name && sortConfig.direction || 'no-sort';
    };

    const sortedItems = React.useMemo(() => {
        let sortableItems = [...currentItems];

        if (sortConfig !== null) {
            sortableItems.sort((a, b) => {
                let aParsed = sortConfig.key === 'created' ? new moment(a[sortConfig.key]).format('YYYYMMDD')
                        : (a[sortConfig.key] ? a[sortConfig.key].toString().toLowerCase().trim() : null);
                let bParsed = sortConfig.key === 'created' ? new moment(b[sortConfig.key]).format('YYYYMMDD')
                        : (b[sortConfig.key] ? b[sortConfig.key].toString().toLowerCase().trim() : null);

                if (aParsed < bParsed) {
                    return sortConfig.direction === 'ascending' ? -1 : 1;
                }
                if (aParsed > bParsed) {
                    return sortConfig.direction === 'ascending' ? 1 : -1;
                }

                return 0;
            });
        }

        return sortableItems;
    }, [currentItems, sortConfig]);

    if (hash(sortedItems) !== hash(currentItems)) {
        setCurrentItems(sortedItems);
    }

    const requestSort = (key) => {
        let direction = key !== 'created' ? 'ascending' : 'descending';

        if (sortConfig && sortConfig.key === key && sortConfig.direction === direction) {
            direction = direction === 'ascending' ? 'descending' : 'ascending';
        }

       setCurrentItems(sortedItems);
       setSortConfig({ key, direction });

       return { sortedItems: currentItems };
    };

    return { sortedItems: currentItems, getClassNamesFor, requestSort };
};

export default useSortableProblemsData;


text:
module.exports = {
	/**
	 * Method called from background job for evaluating request
	 *
	 * @param originalRequest
	 * @param request
	 * @param preparedResponse
	 * @param error
	 * @param response
	 * @param body
	 * @param responseTime
	 * @param done
	 */
	parseRequestResponse: function (originalRequest, request, preparedResponse, error, response, body, responseTime, done) {
		// body is empty on error
		var passing = Object.keys (response).length > 0;

		// assign assertsions
		requestValidatedByAssertions.findAll ({
			attributes: ['id', 'assertionType', 'property', 'expectedValue', 'comparator'],
			where: {requestsId: originalRequest.id},
			include: [{model: assertions}]
		}).then (function (assertions) {

			// evaluate all assertions
			for (i in assertions) {
				if (!evaluator.evaluate (assertions[i], request, response, body, responseTime))
					passing = false;
			}

			if (typeof body == 'object')
				body = JSON.stringify (body);

			// and save the result into database
			preparedResponse.update ({
				responseHeaders: response.headers,
				responseCode: response.statusCode,
				responseSize: body.length,
				responseTime: responseTime,
				responseBodyRaw: body,
				passedAssertions: passing,
				status: passing ? 'success' : 'failed'
			}).then (function (evaluated) {
				originalRequest.update ({lastRunStatus: evaluated.status}).then (function (original) {
					done (null, {request: evaluated.toJSON ()});
				});
			});
		});
	},

	getRequestOptions: function (auth, request, envelope, callback) {
		var options = {
			url: request.requestUrl,
			method: request.requestMethod,
			headers: request.requestHeaders,
			json: true
		};

		if (request.requestMethod != 'GET') {
			var data = {};
			if (envelope != null)
				data[envelope] = request.requestHttpParameters;
			else
				data = request.requestHttpParameters;

			options.form = data;
		}

		if (auth) {
			switch (auth.type) {
				case 'bearer':
					options.auth = {'bearer': auth.token};

					// append to url
					if (auth.tokenParameter) {
						options.url += options.url.indexOf ('?') == -1 ? '?' : '&';
						options.url += auth.tokenParameter + "=" + auth.token
					}
					break;

				case 'base':
					options.auth = {
						user: auth.username,
						pass: auth.password
					};
					break;
			}
		}

		return callback(options);
	},

	/**
	 * Evaluate given assertion
	 *
	 * @param assert
	 *
	 * @param request
	 * @param response
	 * @param body
	 * @param responseTime
	 * @returns {*}
	 */
	evaluate: function (assert, request, response, body, responseTime) {
		var recievedValue = {}, status,
			expectedValue = assert.expectedValue,
			property = assert.property,
			comparator = assert.comparator;

		recievedValue = evaluator.getRecievedValue (assert, request, response, body, responseTime);

		// compare data
		status = evaluator.compare (expectedValue, comparator, recievedValue);

		// create new entry in database
		evaluatedAssertions.create ({
			responsesId: request.id,
			assertionType: assert.assertionType,
			assertionName: assert.assertion.name,
			assertionProperty: assert.property,
			assertionExpectedValue: expectedValue,
			assertionComparator: comparator,
			recievedValue: recievedValue,
			passed: status
		}).then (function (evaluated) {
		});

		console.log(request.id+" evaluated: "+status);

		return status;
	},

	/**
	 * Returns wanted value based on assertion type
	 *
	 * @param requestAssertion
	 * @param request
	 * @param response
	 * @param body
	 * @param responseTime
	 * @returns {*}
	 */
	getRecievedValue: function (requestAssertion, request, response, body, responseTime) {
		switch (requestAssertion.assertionType) {
			case 'status_code':
				return response.statusCode;
				break;

			case 'response_time':
				return responseTime;
				break;
			case 'count':

				var property = evaluator.getProperty (body, requestAssertion.property);
				if (typeof property == 'undefined' || property == null || !property)
					return 0;

				return Object.keys (property).length;
				break;

			case 'property_exists':
				var property = evaluator.getProperty (body, requestAssertion.property);
				return property != false && property != null;
				break;
			case 'property_value':
				return evaluator.getProperty (body, requestAssertion.property);
				break;

			case 'json':
				var content = evaluator.getProperty (body, requestAssertion.property);
				return JSON.stringify (content);
				break;

		}
	},

	/**
	 * Get property value
	 *
	 * This method parses recieved body and returns given property.
	 *
	 * @param body
	 * @param property
	 * @returns {*}
	 */
	getProperty: function (body, property) {

		// because of some kind of weird optimalization reasons

		var route, element, i;
		if (property != null)
			route = property.split ('.').reverse ();

		try {
			element = (typeof body == 'object') ? body : JSON.parse (body);

			// user wants root element
			if (property == null)
				return element;

			i = route.length;

			while (i--) {
				if (element[route[i]] !== undefined) {
					if (i == 0) {
						return element[route[i]];
					}
					element = element[route[i]];
				} else {
					return false;
				}
			}
		} catch (e) {
			return null;
		}
	},

	/**
	 * Universal method for comparing recieved and expected value
	 *
	 * @param expectedValue
	 * @param operator
	 * @param recievedValue
	 * @returns {boolean}
	 */
	compare: function (expectedValue, operator, recievedValue) {
		switch (operator) {
			case 'eq':
				return "" + expectedValue == "" + recievedValue;
				break;
			case 'ge':
				return expectedValue <= recievedValue;
				break;
			case 'le':
				return expectedValue >= recievedValue;
				break;
			case 'ne':
				return expectedValue != recievedValue;
				break;
			case 'gt':
				return expectedValue < recievedValue;
				break;
			case 'lt':
				return expectedValue > recievedValue;
				break;
			case 'in':
				return recievedValue.indexOf (expectedValue) >= 0;
				break;
			case 'not_in':
				return recievedValue.indexOf (expectedValue) < 0;
				break;

		}

		return expectedValue == recievedValue;
	}
};


text:
using Assembler.Instructions;

namespace Assembler.Parsing
{
    public class AddressInstructionParser : IInstructionParser
    {
        private readonly IInstructionParser _nextParser;

        public AddressInstructionParser(IInstructionParser nextParser)
        {
            _nextParser = nextParser;
        }

        public IInstruction ParseInstruction(string line)
        {
            if (!line.StartsWith("@"))
                return _nextParser.ParseInstruction(line);

            int address;
            if (!int.TryParse(line.Substring(1), out address))
                return _nextParser.ParseInstruction(line);

            return new AddressInstruction(address);
        }
    }
}


text:
module.exports = {
  "whiteSpace": {
    "before": {
      "ArgumentComma": 0,
      "ArgumentList": 0,
      "ArrayExpressionClosing": 0,
      "ArrayExpressionComma": 0,
      "ArrayExpressionOpening": 0,
      "ArrayPatternClosing": 0,
      "ArrayPatternComma": 0,
      "ArrayPatternOpening": 1,
      "ArrowFunctionExpressionArrow": 1,
      "ArrowFunctionExpressionClosingBrace": 0,
      "ArrowFunctionExpressionOpeningBrace": 1,
      "AssignmentOperator": 1,
      "AssignmentPattern": 1,
      "BinaryExpression": 0,
      "BinaryExpressionOperator": 1,
      "BlockComment": 1,
      "BlockStatementClosingBrace": 1,
      "BlockStatementOpeningBrace": 1,
      "CallExpression": -1,
      "CallExpressionClosingParentheses": -1,
      "CallExpressionOpeningParentheses": 0,
      "CatchClosingBrace": 1,
      "CatchKeyword": 1,
      "CatchOpeningBrace": 1,
      "CatchParameterList": 0,
      "ClassClosingBrace": 1,
      "ClassOpeningBrace": 1,
      "CommaOperator": 0,
      "ConditionalExpressionAlternate": 1,
      "ConditionalExpressionConsequent": 1,
      "DoWhileStatementClosingBrace": 1,
      "DoWhileStatementConditional": 1,
      "DoWhileStatementOpeningBrace": 1,
      "ElseIfStatementClosingBrace": 1,
      "ElseIfStatementOpeningBrace": 1,
      "ElseStatementClosingBrace": 1,
      "ElseStatementOpeningBrace": 1,
      "EmptyStatement": 0,
      "ExpressionClosingParentheses": 0,
      "FinallyClosingBrace": 1,
      "FinallyKeyword": -1,
      "FinallyOpeningBrace": 1,
      "ForInStatement": 1,
      "ForInStatementClosingBrace": 1,
      "ForInStatementExpressionClosing": 0,
      "ForInStatementExpressionOpening": 1,
      "ForInStatementOpeningBrace": 1,
      "ForOfStatement": 1,
      "ForOfStatementClosingBrace": 1,
      "ForOfStatementExpressionClosing": 0,
      "ForOfStatementExpressionOpening": 1,
      "ForOfStatementOpeningBrace": 1,
      "ForStatement": 1,
      "ForStatementClosingBrace": 1,
      "ForStatementExpressionClosing": 0,
      "ForStatementExpressionOpening": 1,
      "ForStatementOpeningBrace": 1,
      "ForStatementSemicolon": 0,
      "FunctionDeclarationClosingBrace": 1,
      "FunctionDeclarationOpeningBrace": 1,
      "FunctionExpressionClosingBrace": 1,
      "FunctionExpressionOpeningBrace": 1,
      "FunctionGeneratorAsterisk": 0,
      "FunctionName": 1,
      "IIFEClosingParentheses": 0,
      "IfStatementClosingBrace": 1,
      "IfStatementConditionalClosing": 0,
      "IfStatementConditionalOpening": 1,
      "IfStatementOpeningBrace": 1,
      "LineComment": 1,
      "LogicalExpressionOperator": 1,
      "MemberExpressionClosing": 0,
      "MemberExpressionOpening": 0,
      "MemberExpressionPeriod": 0,
      "ModuleSpecifierClosingBrace": 1,
      "ModuleSpecifierComma": 0,
      "ModuleSpecifierOpeningBrace": 1,
      "ObjectExpressionClosingBrace": 0,
      "ObjectExpressionOpeningBrace": -1,
      "ObjectPatternClosingBrace": 0,
      "ObjectPatternComma": 0,
      "ObjectPatternOpeningBrace": 1,
      "ParameterComma": 0,
      "ParameterList": 0,
      "Property": 1,
      "PropertyValue": 1,
      "SwitchCaseBlockEnd": 1,
      "SwitchCaseBlockStart": 1,
      "SwitchCaseColon": 0,
      "SwitchDiscriminantClosing": 0,
      "SwitchDiscriminantOpening": 1,
      "ThrowKeyword": 1,
      "TryClosingBrace": 1,
      "TryKeyword": -1,
      "TryOpeningBrace": 1,
      "UnaryExpressionOperator": 0,
      "UpdateExpressionOperator": 0,
      "VariableDeclarationSemiColon": 0,
      "VariableName": 1,
      "VariableValue": 1,
      "WhileStatementClosingBrace": 1,
      "WhileStatementConditionalClosing": 0,
      "WhileStatementConditionalOpening": 1,
      "WhileStatementOpeningBrace": 1
    }
  }
};