text:
package com.github.liaoheng.common.util;

import android.content.ContentUris;
import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.os.ParcelFileDescriptor;
import android.provider.MediaStore;
import android.text.TextUtils;

import androidx.annotation.RequiresApi;

import com.github.liaoheng.common.Common;
import com.google.common.base.Strings;
import com.google.common.io.FileWriteMode;
import com.google.common.io.Files;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.util.UUID;

/**
 * 文件工具
 *
 Dependency : android.permission.READ_EXTERNAL_STORAGE
 *
 Dependency : android.permission.WRITE_EXTERNAL_STORAGE
 *
 * @author liaoheng
 */
@SuppressWarnings("UnstableApiUsage")
public class FileUtils {
    private static final String TAG = FileUtils.class.getSimpleName();
    public static final String ERROR_SDCARD_NOT_AVAILABLE = "error_sdcard_not_available";
    public static final String ERROR_SDCARD_SPACE_INSUFFICIENT = "error_sdcard_space_insufficient";

    public static void isExternalStorageEnable() throws IOException {
        if (!SDCardUtils.isExternalStorageEnable()) {
            throw new IOException(ERROR_SDCARD_NOT_AVAILABLE);
        }
    }

    public static void isExternalStorageLessMB(File path, long mb) throws IOException {
        if (SDCardUtils.getPathAvailableSize(path) < mb * 1024) {
            throw new IOException(ERROR_SDCARD_SPACE_INSUFFICIENT);
        }
    }

    /**
     * 在父目录下创建文件
     *
     * @param parent   父目录,不存在会自动创建
     * @param fileName 需要创建文件名
     */
    public static File createFile(File parent, String fileName) {
        if (!parent.exists()) {
            createPath(parent);
        }
        File newFile = new File(parent, fileName);
        if (!newFile.exists()) {
            try {
                if (newFile.createNewFile()) {
                    L.alog().d(TAG, "create file :" + newFile.getAbsolutePath());
                }
            } catch (IOException ignored) {
            }
        }
        return newFile;
    }

    /**
     * 在父目录下创建临时文件,使用{@link UUID#randomUUID()}生成文件名
     *
     * @param parent 父目录,不存在会自动创建
     * @param nameEx 需要创建文件格式
     */
    public static File createTempFile(File parent, String nameEx) {
        String fileName = UUID.randomUUID().toString() + "." + nameEx;
        return createFile(parent, fileName);
    }

    /**
     * 在父目录下创建临时文件,使用{@link UUID#randomUUID()}生成文件名
     *
     * @param parent 父目录,不存在会自动创建
     */
    public static File createTempFile(File parent) {
        return createTempFile(parent, "tmp");
    }

    /**
     * 创建路径
     *
     * @param rootPath 父路径
     * @param path     建立的路径
     */
    public static File createPath(String rootPath, String path) {
        return createPath(new File(rootPath, path));
    }

    /**
     * 创建路径
     *
     * @param rootPath 父路径
     * @param path     建立的路径
     */
    public static File createPath(File rootPath, String path) {
        return createPath(new File(rootPath, path));
    }

    /**
     * 创建路径
     *
     * @param path 路径
     */
    public static File createPath(String path) {
        return createPath(new File(path));
    }

    /**
     * 创建路径
     *
     * @param path 路径
     */
    public static File createPath(File path) {
        if (!path.exists()) {
            if (path.mkdirs()) {
                L.alog().d(TAG, "create path:" + path.getAbsolutePath());
            }
        }
        return path;
    }

    /**
     * 建立隐藏所有媒体文件的文件夹
     *
     * @param path 缓存目录
     * @return {@link File}
     */
    @SuppressWarnings("ResultOfMethodCallIgnored")
    public static File createHideMediaDirectory(File path) {
        createPath(path);
        File noMedia = new File(path, ".nomedia");
        if (!noMedia.exists()) {
            try {
                noMedia.createNewFile();
            } catch (IOException ignored) {
            }
        }
        return path;
    }

    //-----------------------------------------外部储存空间----------------------------------------------------

    /**
     * 获取外部储存项目空间目录的路径,sd/Android/data/{package}/
     */
    public static File getProjectSpacePath(Context context) throws IOException {
        File externalCacheDir = context.getExternalCacheDir();
        if (externalCacheDir == null) {
            throw new IOException(ERROR_SDCARD_NOT_AVAILABLE);
        }
        return externalCacheDir.getParentFile();
    }

    /**
     * 在外部储存项目空间中创建目录,sd/Android/data/{package}/{dir}/
     *
     * @param dir 目录名
     */
    public static File createProjectSpaceDir(Context context, String dir) throws IOException {
        return createPath(getProjectSpacePath(context), dir);
    }

    /**
     * 得到外部储存项目空间的临时目录,sd/Android/data/{package}/temp/
     */
    public static File getProjectSpaceTempDirectory(Context context) throws IOException {
        return createProjectSpaceDir(context, "temp");
    }

    /**
     * 得到外部储存项目空间的图片目录,sd/Android/data/{package}/pictures/
     */
    public static File getProjectSpacePicturesDirectory(Context context) throws IOException {
        return createProjectSpaceDir(context, "pictures");
    }

    /**
     * 得到内部储存项目空间的缓存目录,sd/Android/data/{package}/{cacheDir}/
     *
     * @param cacheDir 缓存目录名
     */
    public static File getProjectSpaceCacheDirectory(Context context, String cacheDir) throws IOException {
        isExternalStorageEnable();
        isExternalStorageLessMB(getProjectSpacePath(context), 100);
        return createHideMediaDirectory(createProjectSpaceDir(context, cacheDir));
    }

    //-----------------------------------------外部储存----------------------------------------------------

    /**
     * 获取外部储存项目目录的路径,sd/{project_name}/
     */
    @Deprecated
    public static File getProjectPath(String projectName) {
        return new File(Environment.getExternalStorageDirectory(), projectName);
    }

    /**
     * 获取外部储存项目目录的路径,sd/{project_name}/
     */
    @Deprecated
    public static File getProjectPath() throws IOException {
        return getProjectPath(Common.getProjectName());
    }

    /**
     * 在外部储存项目中创建目录,sd/{project_name}/{dir}/
     *
     * @param dir 目录名
     */
    @Deprecated
    public static File createProjectDir(String dir) throws IOException {
        return createPath(getProjectPath(), dir);
    }

    /**
     * 得到外部储存项目的临时目录,sd/{project_name}/temp/
     */
    @Deprecated
    public static File getProjectTempDirectory() throws IOException {
        return createProjectDir("temp");
    }

    /**
     * 得到外部储存项目的图片目录,sd/{project_name}/pictures/
     */
    @Deprecated
    public static File getProjectPicturesDirectory() throws IOException {
        return createProjectDir("pictures");
    }

    /**
     * 得到外部储存项目的缓存目录,sd/{project_name}/{cacheDir}/
     *
     * @param cacheDir 缓存目录名
     */
    @Deprecated
    public static File getProjectCacheDirectory(String cacheDir) throws IOException {
        isExternalStorageEnable();
        isExternalStorageLessMB(getProjectPath(), 100);
        return createHideMediaDirectory(createProjectDir(cacheDir));
    }

    //-----------------------------------------内部储存----------------------------------------------------

    /**
     * 获取内部储存项目空间的路径,/data/data/{package}/
     */
    public static File getDataProjectPath(Context context) {
        return context.getCacheDir().getParentFile();
    }

    /**
     * 在内部储存项目空间中创建目录,/data/data/{package}/{dir}/
     *
     * @param dir 目录名
     */
    public static File createDataProjectDir(Context context, String dir) {
        return context.getDir(dir, Context.MODE_PRIVATE);
    }

    //-----------------------------------------完----------------------------------------------------

    /**
     * 判断文件是否存在
     */
    public static void exists(File file, String errorMessage) throws IOException {
        if (TextUtils.isEmpty(errorMessage)) {
            errorMessage = "File does not exist.";
        }
        if (file == null) {
            throw new IOException("File is null.");
        }
        if (!file.exists()) {
            throw new IOException(errorMessage);
        }
    }

    /**
     * 判断文件是否存在
     */
    public static void exists(String file, String errorMessage) throws IOException {
        exists(new File(file), errorMessage);
    }

    /**
     * 判断文件是否存在
     */
    public static void exists(String filePath) throws IOException {
        exists(new File(filePath));
    }

    /**
     * 判断文件是否存在
     */
    public static void exists(File filePath) throws IOException {
        exists(filePath, "");
    }

    /**
     * 判断文件是否存在
     */
    public static boolean existsBoolean(File filePath) {
        try {
            exists(filePath, "");
            return true;
        } catch (IOException e) {
            return false;
        }
    }

    /**
     * 判断文件是否存在
     */
    public static boolean existsBoolean(String filePath) {
        try {
            exists(filePath, "");
            return true;
        } catch (IOException e) {
            return false;
        }
    }

    /**
     * 删除文件或目录
     */
    public static void delete(File file) {
        if (file == null) {
            return;
        }
        if (!file.exists()) {
            return;
        }
        if (file.delete()) {
            L.alog().d(TAG, "delete file :" + file.getAbsolutePath());
        }
    }

    /**
     * 清空路径
     */
    @SuppressWarnings("ResultOfMethodCallIgnored")
    public static void cleanPath(File path) {
        if (path == null) {
            return;
        }
        if (!path.isDirectory()) {
            return;
        }
        File[] files = path.listFiles();
        if (files == null) {
            return;
        }
        for (final File file : files) {
            file.delete();
        }
        L.alog().d(TAG, "clean path :" + path.getAbsolutePath());
    }

    /**
     * 获取文件夹大小
     *

     *

     *            Context.getExternalFilesDir() --> SDCard/Android/data/你的应用的包名/files/ 目录,一般放一些长时间保存的数据
     *      Context.getExternalCacheDir() --> SDCard/Android/data/你的应用包名/cache/目录,一般存放临时缓存数据
     *

     *

     */
    public static long getFolderSize(File file) {
        long size = 0;
        if (!file.isDirectory()) {
            return file.length();
        }
        File[] fileList = file.listFiles();
        for (int i = 0; i < fileList.length; i++) {
            // 如果下面还有文件
            if (fileList[i].isDirectory()) {
                size = size + getFolderSize(fileList[i]);
            } else {
                size = size + fileList[i].length();
            }
        }
        return size;
    }

    /**
     * 格式化文件大小单位
     */
    public static String getFormatSize(double size) {
        double kiloByte = size / 1024;
        if (kiloByte < 1) {
            return size + "Byte";
        }

        double megaByte = kiloByte / 1024;
        if (megaByte < 1) {
            BigDecimal result1 = new BigDecimal(Double.toString(kiloByte));
            return result1.setScale(2, BigDecimal.ROUND_HALF_UP)
                    .toPlainString() + "KB";
        }

        double gigaByte = megaByte / 1024;
        if (gigaByte < 1) {
            BigDecimal result2 = new BigDecimal(Double.toString(megaByte));
            return result2.setScale(2, BigDecimal.ROUND_HALF_UP)
                    .toPlainString() + "MB";
        }

        double teraBytes = gigaByte / 1024;
        if (teraBytes < 1) {
            BigDecimal result3 = new BigDecimal(Double.toString(gigaByte));
            return result3.setScale(2, BigDecimal.ROUND_HALF_UP)
                    .toPlainString() + "GB";
        }
        BigDecimal result4 = new BigDecimal(teraBytes);
        return result4.setScale(2, BigDecimal.ROUND_HALF_UP).toPlainString()
                + "TB";
    }

    public static String getExtension(String fullName) {
        return Files.getFileExtension(fullName);
    }

    public static String getName(String fullName) {
        String extension = getExtension(fullName);
        return Files.getNameWithoutExtension(fullName) + (Strings.isNullOrEmpty(extension) ? "" : "." + extension);
    }

    public static void copyInputStreamToFile(InputStream source, final File destination) throws IOException {
        Files.asByteSink(destination, FileWriteMode.APPEND).writeFrom(source);
    }

    //https://juejin.im/post/5d0b1739e51d4510a73280cc
    public static Uri saveFileToPictureCompat(Context context, String name, File from) throws IOException {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
            return saveFileToPicture(context, name, from);
        } else {
            boolean isExternalStorageLegacy = true;
            try {
                isExternalStorageLegacy = Environment.isExternalStorageLegacy();
            } catch (NoSuchMethodError ignored) {
            }
            if (isExternalStorageLegacy) {
                return saveFileToPicture(context, name, from);
            }
            return saveFileToPictureQ(context, name, from);
        }
    }

    @SuppressWarnings("UnstableApiUsage")
    public static Uri saveFileToPicture(Context context, String name, File from) throws IOException {
        File file = new File(SDCardUtils.getExternalStoragePicturesPublicDirectory(), Common.getProjectName());
        File outFile = FileUtils.createFile(file, name);
        Files.copy(from, outFile);
        Uri uri = Uri.fromFile(outFile);
        context.sendBroadcast(
                new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
        return uri;
    }

    //https://developer.android.com/training/data-storage/files/external-scoped
    @SuppressWarnings("UnstableApiUsage")
    @RequiresApi(api = Build.VERSION_CODES.Q)
    public static Uri saveFileToPictureQ(Context context, String name, File from) throws IOException {
        Uri uri;
        ContentValues contentValues = null;
        try (Cursor query = context.getContentResolver().query(MediaStore.Images.Media.getContentUri(
                MediaStore.VOLUME_EXTERNAL_PRIMARY), null,
                MediaStore.Images.Media.DISPLAY_NAME + "='" + name + "' AND "
                        + MediaStore.Images.Media.OWNER_PACKAGE_NAME + "='"
                        + context.getPackageName() + "'",
                null, null)) {
            if (query != null && query.moveToFirst()) {
                long id = query.getLong(query.getColumnIndex(MediaStore.Images.Media._ID));
                uri = ContentUris.withAppendedId(
                        MediaStore.Images.Media.getContentUri(MediaStore.VOLUME_EXTERNAL_PRIMARY), id);
            } else {
                contentValues = new ContentValues();
                contentValues.put(MediaStore.Images.Media.DISPLAY_NAME, name);
                contentValues.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
                contentValues.put(MediaStore.Images.Media.IS_PENDING, 1);
                contentValues.put(MediaStore.Images.Media.RELATIVE_PATH,
                        Environment.DIRECTORY_PICTURES + File.separator + Common.getProjectName());
                uri = context.getContentResolver().insert(MediaStore.Images.Media.getContentUri(
                        MediaStore.VOLUME_EXTERNAL_PRIMARY), contentValues);
            }
        }

        if (uri == null) {
            throw new IOException("getContentResolver uri is null");
        }
        ParcelFileDescriptor fd = context.getContentResolver().openFileDescriptor(uri, "w");
        if (fd == null) {
            throw new IOException("openFileDescriptor is null");
        }
        Files.copy(from, new FileOutputStream(fd.getFileDescriptor()));
        if (contentValues != null) {
            contentValues.clear();
            contentValues.put(MediaStore.Images.Media.IS_PENDING, 0);
            context.getContentResolver().update(uri, contentValues, null, null);
        }
        return uri;
    }
}


text:
<?php
/**
 * Docblock state
 *
 * @package     stubbles
 * @subpackage  reflection_annotations_parser_state
 * @version     $Id: stubAnnotationDocblockState.php 2857 2011-01-10 13:43:39Z mikey $
 */
stubClassLoader::load('net::stubbles::reflection::annotations::parser::state::stubAnnotationAbstractState',
                      'net::stubbles::reflection::annotations::parser::state::stubAnnotationState'
);
/**
 * Docblock state
 *
 * @package     stubbles
 * @subpackage  reflection_annotations_parser_state
 */
class stubAnnotationDocblockState extends stubAnnotationAbstractState implements stubAnnotationState
{
    /**
     * processes a token
     *
     * @param   string  $token
     * @throws  ReflectionException
     */
    public function process($token)
    {
        if ('@' === $token) {
            $this->parser->changeState(stubAnnotationState::ANNOTATION_NAME);
            return;
        }

        // all character except * and space and line breaks
        if (' ' !== $token && '*' !== $token && "\n" !== $token && "\t" !== $token) {
            $this->parser->changeState(stubAnnotationState::TEXT);
        }
    }
}
?>

redpajama_set_name: RedPajamaGithub


text:
function s = addfield(s, field_name, field_val)
% function s = addfield(s, field_name, field_val)
% Add field_name to all structures in the structure with a value of field_val

% AUTORIGHTS
% ---------------------------------------------------------
% Copyright (c) 2014, Saurabh Gupta
%
% This file is part of the Utils code and is available
% under the terms of the Simplified BSD License provided in
% LICENSE. Please retain this notice and LICENSE if you use
% this file (or any portion of it) in your project.
% ---------------------------------------------------------

  tmp = {};
  for i = 1:length(s),
    tmp{i} = field_val;
  end
  [s(:).(field_name)] = deal(tmp{:});
end


text:
import 'jquery';
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.css';
import 'hover.css';
import '@fortawesome/fontawesome-free/js/all.js';

import '../sass/app.scss';


text:
// @ts-nocheck
const fs = require("fs")
const https = require("https")
const path = require("path")

const ASSETS_DIR = path.resolve(__dirname, "../Pod/Assets/PreHeatedGraphQLCache")
const CREATED_AT_FILENAME = "PreheatedCacheCreatedAt.txt"

/**
 * @typedef {Object} QueryParams
 * @property {string} query
 * @property {string} documentID
 * @property {{ [key: string]: any }} variables
 */

/**
 * @param {QueryParams} queryParams
 * @param {string} filename
 * @param {Date} freshness The date from when the pre-heated cache should be ignored.
 * @param {number} ttl The TTL applied to the cache once put in place. Defaults to the default specified in `ARGraphQLQueryCache.m`.
 */
module.exports = function preheatGraphQLCache(queryParams, filename, freshness, ttl = 0) {
  // We don't use the persisted ID here because the queries may not actually have been persisted yet.
  const { documentID: _documentID, ...queryParamsForRequest } = queryParams
  // While we fetch using the actual query test, for the cache we want to simulate a runtime query, which uses the
  // persisted ID.
  const { query: _query, ...queryParamsForCache } = queryParams

  const requestPostData = JSON.stringify(queryParamsForRequest)
  const options = {
    hostname: "metaphysics-production.artsy.net",
    port: 443,
    path: "/",
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      "Content-Length": requestPostData.length,
    },
  }

  const req = https.request(options, res => {
    if (res.statusCode !== 200) {
      throw new Error(`Failed with status code: ${res.statusCode}`)
    }

    const responseData = []
    res.on("data", chunk => responseData.push(chunk))

    res.on("end", () => {
      const graphqlResponse = JSON.parse(Buffer.concat(responseData).toString("utf8"))
      if (graphqlResponse.errors && graphqlResponse.errors.length > 0) {
        throw new Error(`Failed with GraphQL errors: ${JSON.stringify(graphqlResponse.errors)}`)
      }
      fs.writeFile(
        path.join(ASSETS_DIR, filename),
        JSON.stringify({
          ttl,
          graphqlResponse,
          queryParams: queryParamsForCache,
          freshness: freshness.getTime() / 1000, // Time since UNIX epoc in seconds.
        }),
        "utf8",
        error => {
          if (error) throw error
        }
      )
      fs.writeFile(path.join(ASSETS_DIR, CREATED_AT_FILENAME), new Date().toISOString(), "utf8", error => {
        if (error) throw error
      })
    })
  })

  req.on("error", error => {
    throw error
  })

  req.write(requestPostData)
  req.end()
}


text:
    <!-- scripts -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="{{ site.baseurl }}/js/vendor/jquery-1.9.0.min.js"><\/script>')</script>

    <script src="//cdnjs.cloudflare.com/ajax/libs/numeral.js/2.0.4/numeral.min.js"></script>

    <script src="{{ site.baseurl }}/js/production.min.js"></script>

    {% include google_analytics.html %}
</body>
</html>


text:
from SuperDiffer.tests import *
from SuperDiffer.id import controllers as ID
from sqlalchemy import exc
import json
import base64
import os

class DiffE2ETestCases(SupperDifferBaseTestCase):
    """Test cases to verify if the endpoints can be used together safelly to load images as base64 values"""

    def _load_image_on_json(self, image_name):
        json_to_send = {"data":""}
        basedir = os.path.abspath(os.path.dirname(__file__))

        with open(basedir + os.sep + image_name, "rb") as image_file:
            json_to_send["data"] = base64.b64encode(image_file.read())

        return json_to_send

    def _post_on_descriptor(self, id, descriptor, data_to_send):
        result = self.app.post("/v1/diff/" + id + "/" + descriptor,
                               data = json.dumps(data_to_send),
                               content_type = "application/json")
        self.assertEqual("201 CREATED", result.status)

    def _get_diff(self, id):
        result = self.app.get("/v1/diff/" + id)
        self.assertEqual("200 OK", result.status)
        return json.loads(result.data)

    @groups(END_TO_END_TESTS_GROUP)
    def test_diff_e2e_lenna1_left_right(self):
        #Given Lenna1 is loaded on left and right
        data_to_post_left = self._load_image_on_json("Lenna.1.png")
        data_to_post_right = self._load_image_on_json("Lenna.1.png")
        self._post_on_descriptor("1", "left", data_to_post_left)
        self._post_on_descriptor("1", "right", data_to_post_right)

        #When the diff is returned
        response_diff_json = self._get_diff("1")

        #Then no difference is found
        self.assertEqual({"size":"equal", "diffs":[]}, response_diff_json)

    @groups(END_TO_END_TESTS_GROUP)
    def test_diff_e2e_lenna1_left_lenna2_right(self):
        #Given Lenna1 is loaded on left and right
        data_to_post_left = self._load_image_on_json("Lenna.1.png")
        data_to_post_right = self._load_image_on_json("Lenna.2.png")

        self._post_on_descriptor("1", "left", data_to_post_left)
        self._post_on_descriptor("1", "right", data_to_post_right)

        #When the diff is returned
        response_diff_json = self._get_diff("1")

        #Then no difference is found
        self.assertEqual({"size":"not equal", "diffs":[]}, response_diff_json)


text:
<?php

namespace PM\WorkspaceBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Workspace
 *
 * @ORM\Table()
 * @ORM\Entity(repositoryClass="PM\WorkspaceBundle\Entity\WorkspaceRepository")
 */
class Workspace
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

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

    /**
     *
     * @ORM\OneToMany(targetEntity="Task", mappedBy="workspace")
     */
    private $tasks;

    /**
     * @ORM\OneToMany(targetEntity="PM\WorkspaceBundle\Entity\UserRoleWorkspace", mappedBy="workspace")
     */
    private $userRoleWorkspace;

    /**
     * @ORM\OneToMany(targetEntity="Workflow", mappedBy="workspace")
     */
    private $workflows;

    /**
     * @ORM\OneToMany(targetEntity="Directory", mappedBy="workspace")
     */
    private $directories;

    /**
     * @ORM\OneToMany(targetEntity="PM\WorkspaceBundle\Entity\TodoHiddenStatus", mappedBy="status", cascade={"remove", "persist"})
     */
    private $todoHiddenStatus;

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

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

        return $this;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->tasks = new \Doctrine\Common\Collections\ArrayCollection();
        $this->userRoleWorkspace = new \Doctrine\Common\Collections\ArrayCollection();
    }

    /**
     * Add tasks
     *
     * @param \PM\WorkspaceBundle\Entity\Task $tasks
     * @return Workspace
     */
    public function addTask(\PM\WorkspaceBundle\Entity\Task $tasks)
    {
        $this->tasks[] = $tasks;

        return $this;
    }

    /**
     * Remove tasks
     *
     * @param \PM\WorkspaceBundle\Entity\Task $tasks
     */
    public function removeTask(\PM\WorkspaceBundle\Entity\Task $tasks)
    {
        $this->tasks->removeElement($tasks);
    }

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

    /**
     * Add userRoleWorkspace
     *
     * @param \PM\WorkspaceBundle\Entity\UserRoleWorkspace $userRoleWorkspace
     * @return Workspace
     */
    public function addUserRoleWorkspace(\PM\WorkspaceBundle\Entity\UserRoleWorkspace $userRoleWorkspace)
    {
        $this->userRoleWorkspace[] = $userRoleWorkspace;

        return $this;
    }

    /**
     * Remove userRoleWorkspace
     *
     * @param \PM\WorkspaceBundle\Entity\UserRoleWorkspace $userRoleWorkspace
     */
    public function removeUserRoleWorkspace(\PM\WorkspaceBundle\Entity\UserRoleWorkspace $userRoleWorkspace)
    {
        $this->userRoleWorkspace->removeElement($userRoleWorkspace);
    }

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

    /**
     * Add workflow
     *
     * @param \PM\WorkspaceBundle\Entity\Workflow $workflow
     * @return Workspace
     */
    public function addWorkflow(\PM\WorkspaceBundle\Entity\Workflow $workflow)
    {
        $this->workflows[] = $workflow;

        return $this;
    }

    /**
     * Remove workflow
     *
     * @param \PM\WorkspaceBundle\Entity\Workflow $workflow
     */
    public function removeWorkflow(\PM\WorkspaceBundle\Entity\Workflow $workflow)
    {
        $this->workflows->removeElement($workflow);
    }

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

    /**
     * Add todoHiddenStatus
     *
     * @param \PM\WorkspaceBundle\Entity\TodoHiddenStatus $todoHiddenStatus
     * @return Workspace
     */
    public function addTodoHiddenStatus(\PM\WorkspaceBundle\Entity\TodoHiddenStatus $todoHiddenStatus)
    {
        $this->todoHiddenStatus[] = $todoHiddenStatus;

        return $this;
    }

    /**
     * Remove todoHiddenStatus
     *
     * @param \PM\WorkspaceBundle\Entity\TodoHiddenStatus $todoHiddenStatus
     */
    public function removeTodoHiddenStatus(\PM\WorkspaceBundle\Entity\TodoHiddenStatus $todoHiddenStatus)
    {
        $this->todoHiddenStatus->removeElement($todoHiddenStatus);
    }

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

    /**
     * Add directories
     *
     * @param \PM\WorkspaceBundle\Entity\Directory $directories
     * @return Workspace
     */
    public function addDirectory(\PM\WorkspaceBundle\Entity\Directory $directories)
    {
        $this->directories[] = $directories;

        return $this;
    }

    /**
     * Remove directories
     *
     * @param \PM\WorkspaceBundle\Entity\Directory $directories
     */
    public function removeDirectory(\PM\WorkspaceBundle\Entity\Directory $directories)
    {
        $this->directories->removeElement($directories);
    }

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


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

namespace Google\Cloud\Compute\V1\VpnGateway;

use UnexpectedValueException;

/**
 * The stack type for this VPN gateway to identify the IP protocols that are enabled. If not specified, IPV4_ONLY will be used.
 *
 * Protobuf type google.cloud.compute.v1.VpnGateway.StackType
 */
class StackType
{
    /**
     * A value indicating that the enum field is not set.
     *
     * Generated from protobuf enum UNDEFINED_STACK_TYPE = 0;
     */
    const UNDEFINED_STACK_TYPE = 0;
    /**
     * Enable VPN gateway with both IPv4 and IPv6 protocols.
     *
     * Generated from protobuf enum IPV4_IPV6 = 22197249;
     */
    const IPV4_IPV6 = 22197249;
    /**
     * Enable VPN gateway with only IPv4 protocol.
     *
     * Generated from protobuf enum IPV4_ONLY = 22373798;
     */
    const IPV4_ONLY = 22373798;

    private static $valueToName = [
        self::UNDEFINED_STACK_TYPE => 'UNDEFINED_STACK_TYPE',
        self::IPV4_IPV6 => 'IPV4_IPV6',
        self::IPV4_ONLY => 'IPV4_ONLY',
    ];

    public static function name($value)
    {
        if (!isset(self::$valueToName[$value])) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no name defined for value %s', __CLASS__, $value));
        }
        return self::$valueToName[$value];
    }

    public static function value($name)
    {
        $const = __CLASS__ . '::' . strtoupper($name);
        if (!defined($const)) {
            throw new UnexpectedValueException(sprintf(
                    'Enum %s has no value defined for name %s', __CLASS__, $name));
        }
        return constant($const);
    }
}


text:
function B0 = addNoise(B0,options)

fprintf('Add speckle noise with variance %.2f to the image\n',options{2});
% A = A + n*A where n is a uniform distribution with mean 0 and variance options{2}
B0 = max(0,min(B0 + (rand(size(B0))-0.5)*sqrt(12*options{2}).*B0,1));


text:
<?php

namespace Modus\Response;

abstract class ContentTypes
{
    const ALL = '*/*';

    const APPLICATION_JSON = 'application/json';
    const APPLICATION_XML = 'appplication/xml';
    const APPLICATION_PDF = 'application/pdf';

    const IMAGE_GIF = 'image/gif';
    const IMAGE_PNG = 'image/png';
    const IMAGE_PJPEG = 'image/pjpeg';
    const IMAGE_BMP = 'image/bmp';
    const IMAGE_SVGXML = 'image/svg+xml';
    const IMAGE_TIFF = 'image/tiff';

    const TEXT_CSS = 'text/css';
    const TEXT_CSV = 'text/csv';
    const TEXT_HTML = 'text/html';
    const TEXT_MARKDOWN = 'text/markdown';
    const TEXT_JAVASCRIPT = 'text/javascript';
    const TEXT_PLAIN = 'text/plain';
    const TEXT_RTF = 'text/rtf';
    const TEXT_VCARD = 'text/vcard';
    const TEXT_XML = 'text/xml';

    const VIDEO_AVI = 'video/avi';
    const VIDEO_MPEG = 'video/mpeg';
    const VIDEO_MP4 = 'video/mp4';
    const VIDEO_OGG = 'video/ogg';
    const VIDEO_QUICKTIME = 'video/qicktime';
    const VIDEO_WEBM = 'video/webm';
    const VIDEO_MATROSKA = 'video/matroska';
    const VIDEO_WINDOWS = 'video/x-ms-wmv';
    const VIDEO_FLASH = 'video/x-flv';
}


text:
'use strict';

var Set = require('es6-set/primitive')

  , create = Object.create;

module.exports = function (t, a) {
	var proto = create(Set.prototype), initialized, set, event;

	t(proto, function () { initialized = true; });

	set = create(proto);
	set = proto.constructor.call(set);

	set.add('foo');
	a(initialized, undefined, "Not observable");
	set.on('foo', function () {});
	a(initialized, undefined, "Not 'change' listener");
	set.on('change', function (e) { event = e; });
	a(initialized, true, "'change' listener");

	set.add('raz');
	set._emitAdd_('raz');
	a.deep(event, { type: 'add', value: 'raz', target: set }, "Event");
};


text:
var WebView = require('ui/common/WebView');
var GetFeed = require('ui/common/GetFeed');
var SocialMediaIcons = require('ui/common/SocialMediaIcons');

function HomeSMSection(tracker){
	var socialMediaView = Ti.UI.createView({

			backgroundColor: 	'#e2e2e2',
			height:				36,
			width: 				300,
			left: 				10,
			top:				10,
		});

		var row = Ti.UI.createTableViewRow();
		row.add(socialMediaView);

		var icon = new SocialMediaIcons();

	var facebookimage = icon.facebook(0,0,tracker);
	var twitterimage = icon.twitter(0,53.6,tracker);
	var instagramimage = icon.instagram(0,107.2,tracker);
	var linkedInimage = icon.linkedIn(0,160.8,tracker);
	var foursquareimage = icon.foursquare(0,214.4,tracker);
	var pinterestimage = icon.pinterest(0,268,tracker);

		//Width (Images)
		pinterestimage.width =  foursquareimage.width = linkedInimage.width = instagramimage.width = twitterimage.width = facebookimage.width = 32;

		//Height (Images)
		pinterestimage.height =   foursquareimage.height =  linkedInimage.height = instagramimage.height = twitterimage.height = facebookimage.height = 32;
	//----------------------------------------------------------------------------------------------------------
		socialMediaView.add(facebookimage);
		socialMediaView.add(twitterimage);
		socialMediaView.add(instagramimage);
		socialMediaView.add(linkedInimage);
		socialMediaView.add(foursquareimage);
		socialMediaView.add(pinterestimage);

		return row;
}

module.exports = HomeSMSection;


text:
import React from 'react';
import cx from 'classnames';
import dedent from 'dedent';

import LeftRight from '../../../../components/LeftRight/LeftRight';
import Specimen from '../../../components/Specimen/Specimen';
import { H, T, A, C } from '../../../components/Scaffold/Scaffold';

import css from './LeftRight.css';
import m from '../../../../globals/modifiers.css';

const LeftRightDocumentation = () => (

    <H level={ 1 }>LeftRight</H>
    <T elm="p" className={ cx(m.mtr, m.largeI, m.demi) }>
      LeftRight is purely a layout component. It can be used to build thing such
      as media objects.
      Content in the secondary side will only take up as much horizontal space
      as required, leaving the primary side to fill up the remain space, without
      wrapping around it.
    </T>
    <T elm="p" className={ m.mtLgIi }>
      By default, the largest side is on the left.
    </T>
    <Specimen
      classNames={ {
        root: m.mtr,
        specimenContainer: m.par,
      } }
      code={ dedent`
        <LeftRight
          leftChildren={ (

Primary

          ) }
          rightChildren={ (

Secondary

          ) }
        />
      ` }
    >
      <LeftRight
        leftChildren={
Primary
 }
        rightChildren={
Secondary
 }
      />
    </Specimen>
    <T elm="p" className={ m.mtLgIi }>
      You can swap this using the <C>primarySide</C> prop.
    </T>
    <Specimen
      classNames={ {
        root: m.mtr,
        specimenContainer: m.par,
      } }
      code={ dedent`
        <LeftRight
          leftChildren={ (

Secondary

          ) }
          rightChildren={ (

Primary

          ) }
          primarySide="right"
        />
      ` }
    >
      <LeftRight
        rightChildren={
Primary
 }
        leftChildren={
Secondary
 }
        primarySide="right"
      />
    </Specimen>

);

export default LeftRightDocumentation;


text:
angular.
    module('core.template', [
        'core.template.block',
        'core.template.keyword'
    ]);


text:
<?php

namespace Ndm\OAuth\Exception;

/**
 *
 */
class UnauthorisedException extends OAuthException {}


text:
'use strict';

var Bitcore = require('bitcore-wallet-utils').Bitcore;

function Address() {};

Address.create = function(opts) {
  opts = opts || {};

  var x = new Address();

  x.version = '1.0.0';
  x.createdOn = Math.floor(Date.now() / 1000);
  x.address = opts.address;
  x.walletId = opts.walletId;
  x.isChange = opts.isChange;
  x.path = opts.path;
  x.publicKeys = opts.publicKeys;
  x.network = Bitcore.Address(x.address).toObject().network;
  return x;
};

Address.fromObj = function(obj) {
  var x = new Address();

  x.version = obj.version;
  x.createdOn = obj.createdOn;
  x.address = obj.address;
  x.walletId = obj.walletId;
  x.network = obj.network;
  x.isChange = obj.isChange;
  x.path = obj.path;
  x.publicKeys = obj.publicKeys;
  return x;
};

/**
 * getScriptPubKey
 *
 * @param {number} threshold - amount of required signatures to spend the output
 * @return {Script}
 */
Address.prototype.getScriptPubKey = function(threshold) {
  return Bitcore.Script.buildMultisigOut(this.publicKeys, threshold).toScriptHashOut();
};

module.exports = Address;


text:
describe 'get customer number' do

  before(:all) do
    plsql.customers.insert({customer_id: -1, customer_no: 123456, customer_valid_flag: '1' })
  end

  it 'returns expected customer number as a numeric value' do
    expect( plsql.some_table_api.get_customer_no(-1) ).to eq 123456
  end

  it 'returns expected customer number as a numeric value through assignment' do
    result = plsql.some_table_api.get_customer_no(-1)
    expect( result ).to eq 123456
  end

end

describe 'get customer number for existing data' do

  before(:all) do
    @tested_customer = plsql.customers.first
  end

  it 'returns expected customer number' do
    expect(
        plsql.some_table_api.get_customer_no( @tested_customer[:customer_id] )
    ).to eq @tested_customer[:customer_no]
  end

  it 'returns expected customer number through assignment' do
    result = plsql.some_table_api.get_customer_no( @tested_customer[:customer_id] )
    expect( result ).to eq @tested_customer[:customer_no]
  end

  it 'returns expected customer number with type check' do
    result = plsql.some_table_api.get_customer_no( @tested_customer[:customer_id] )
    expect( result.class ).to eq(Fixnum)
    expect( result ).to eq @tested_customer[:customer_no]
  end

end


text:
<?xml version='1.0'?>
<xslTutorial>
<COLGROUP>this</COLGROUP><COLGROUP>rocks</COLGROUP>
<COLGROUP>this</COLGROUP> <COLGROUP>rocks</COLGROUP>
<COLGROUP>this</COLGROUP>
<COLGROUP>rocks</COLGROUP>
<COLGROUP>this</COLGROUP>		<COLGROUP>rocks</COLGROUP>

this<COLGROUP>rocks</COLGROUP>
this <COLGROUP>rocks</COLGROUP>
</xslTutorial>


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/context
    http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- Define your beans here -->

    <!-- define the dependency -->
    <bean id="myFortuneService"
    		class="com.luv2code.springdemo.HappyFortuneService">
    	</bean>

 	<bean id="myCoach"
 		class="com.luv2code.springdemo.TrackCoach">
 	</bean>

    <!--
    <bean id="myCoach"
        class="com.luv2code.springdemo.BaseballCoach">
    </bean>
    -->

</beans>


text:
require 'roronoa/version'
require 'date'

module Roronoa
  class Zoro
    def self.eye(date = DateTime.now)
      str_time = date.strftime('%H:%M').gsub(/^0/, '')
      result = ''
      0.upto(23) do |count|
        result = str_time.match(/^#{count}+:#{count}+$/).nil? ? nil : str_time.to_s
        break unless result.nil?
      end
      result
    end
  end
end


text:
A simple command line tool to delete a range of snapshots of VirtualBox VM's.

## Usage
https://www.youtube.com/watch?v=6Cm-dJ83W6c


text:
/*
 * File:   IResource.h
 * Author: yevgeniy.logachev
 */

#ifndef IRESOURCE_H
#define IRESOURCE_H

#include "Global.h"

namespace jam {

class IResource : public std::enable_shared_from_this<IResource> {
    JAM_OBJECT_BASE
public:
    typedef std::vector<uint8_t> TResourceData;

public:
    IResource(const std::string& filename);
    IResource(const std::string& name, const TResourceData& data);
    virtual ~IResource();

    const std::string& Filename() const;
    virtual const TResourceData& RawData();
    virtual bool Load();
    virtual void Unload();

    // In most cases hash will be match with the filename,
    // override it if you want to make a unique hash for some resources (for ex. materials)
    virtual const std::string& Hash();

private:
    bool Load(const std::string& filename);

private:
    TResourceData m_Data;
    std::string m_Filename;
    bool m_IsExternalData;
};

}; // namespace jam

#endif /* IRESOURCE_H */


text:
import qi
import argparse
import sys
import time
import threading
import json

import action_base
from action_base import *

actionName = "saveposition"

def actionThread_exec (params):
    t = threading.currentThread()
    memory_service = getattr(t, "mem_serv", None)
    print "Action "+actionName+" started with params "+params
    # action init
    count = 1
    try:
        car_x, car_y , car_t = memory_service.getData('NAOqiLocalizer/RobotPose')
        last_node = memory_service.getData('TopologicalNav/LastNode')
    except Exception:
        car_x = 0
        car_y = 0
        last_node = 'start'

    position_name = params
    # action init
    print "Action "+actionName+" "+params+" exec..."
    # action exec
    print "saved" + position_name

    memory_service.insertData(position_name+"/coordinates",str(car_x)+"_"+str(car_y))
    memory_service.insertData(position_name+"/waypoint", last_node)

    # action exec
    time.sleep(0.1)

    # action end
    action_success(actionName,params)

def init(session):
    print actionName+" init"
    action_base.init(session, actionName, actionThread_exec)

def quit():
    print actionName+" quit"
    actionThread_exec.do_run = False

if __name__ == "__main__":

    app = action_base.initApp(actionName)

    init(app.session)

    #Program stays at this point until we stop it
    app.run()

    quit()


text:
//
//  Generated by the J2ObjC translator.  DO NOT EDIT!
//  source: android/frameworks/base/core/java/android/text/SpannedString.java
//

#include "../../J2ObjC_header.h"

#pragma push_macro("INCLUDE_ALL_AndroidTextSpannedString")
#ifdef RESTRICT_AndroidTextSpannedString
#define INCLUDE_ALL_AndroidTextSpannedString 0
#else
#define INCLUDE_ALL_AndroidTextSpannedString 1
#endif
#undef RESTRICT_AndroidTextSpannedString

#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

#if !defined (AndroidTextSpannedString_) && (INCLUDE_ALL_AndroidTextSpannedString || defined(INCLUDE_AndroidTextSpannedString))
#define AndroidTextSpannedString_

#define RESTRICT_AndroidTextSpannableStringInternal 1
#define INCLUDE_AndroidTextSpannableStringInternal 1
#include "../../android/text/SpannableStringInternal.h"

#define RESTRICT_JavaLangCharSequence 1
#define INCLUDE_JavaLangCharSequence 1
#include "../../java/lang/CharSequence.h"

#define RESTRICT_AndroidTextGetChars 1
#define INCLUDE_AndroidTextGetChars 1
#include "../../android/text/GetChars.h"

#define RESTRICT_AndroidTextSpanned 1
#define INCLUDE_AndroidTextSpanned 1
#include "../../android/text/Spanned.h"

/*!
 @brief This is the class for text whose content and markup are immutable.
 For mutable markup, see SpannableString; for mutable text,
 see SpannableStringBuilder.
 */
@interface AndroidTextSpannedString : AndroidTextSpannableStringInternal < JavaLangCharSequence, AndroidTextGetChars, AndroidTextSpanned >

#pragma mark Public

- (instancetype)initWithJavaLangCharSequence:(id<JavaLangCharSequence>)source;

- (id<JavaLangCharSequence>)subSequenceFrom:(jint)start
                                         to:(jint)end;

+ (AndroidTextSpannedString *)valueOfWithJavaLangCharSequence:(id<JavaLangCharSequence>)source;

@end

J2OBJC_EMPTY_STATIC_INIT(AndroidTextSpannedString)

FOUNDATION_EXPORT void AndroidTextSpannedString_initWithJavaLangCharSequence_(AndroidTextSpannedString *self, id<JavaLangCharSequence> source);

FOUNDATION_EXPORT AndroidTextSpannedString *new_AndroidTextSpannedString_initWithJavaLangCharSequence_(id<JavaLangCharSequence> source) NS_RETURNS_RETAINED;

FOUNDATION_EXPORT AndroidTextSpannedString *create_AndroidTextSpannedString_initWithJavaLangCharSequence_(id<JavaLangCharSequence> source);

FOUNDATION_EXPORT AndroidTextSpannedString *AndroidTextSpannedString_valueOfWithJavaLangCharSequence_(id<JavaLangCharSequence> source);

J2OBJC_TYPE_LITERAL_HEADER(AndroidTextSpannedString)

#endif

#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_AndroidTextSpannedString")


text:
Version 2.0.71 by Volodymyr Volynets

	<time class="change_log_date_commit" datetime="2019-10-13">2019-10-13</time>

Framework

	Enhancement #1259 (Report builder added chart.)

Repository / Git:
	Name: Numbers\Framework
	Title: Numbers Framework
	Version: 2.0.70
	Last Tag: 2.0.70
	User Name: Volodymyr Volynets
	User Email: volodymyr.volynets@gmail.com
Statistics:
	Addition: 7
	Deletion: 0
Modules:
	Numbers Framework (Numbers\Framework, 2.0.70)                                             |     7    0
		    5    0	 | Functions.php
		    2    0	 | Object/Form/Builder/Report.php


text:
package org.oscii.corpus;

import java.util.ArrayList;

/**
 * A compact posting list.
 */
public class PostingList extends ArrayList<Long> {
    // TODO enforce that it stays EMPTY
    public static PostingList EMPTY = new PostingList(0);

    public PostingList() {
        this(1);
    }

    public PostingList(int k) {
        super(k);
    }

    public void addPosting(int line, int position) {
        add(newPosting(line, position));
    }

    public int line(int index) {
        return lineOfPosting(get(index));
    }

    public int position(int index) {
        return positionOfPosting(get(index));
    }

    public static int lineOfPosting(long posting) {
        return (int) (posting >> 32);
    }

    public static int positionOfPosting(long posting) {
        return (int) posting;
    }

    public static long newPosting(int line, int position) {
        return (long) line << 32 | position & 0xFFFFFFFFL;
    }
}


text:
package com.amazonaws.services.personalize.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS API
 *      Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class CreateSchemaRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The name for the schema.
     *

     */
    private String name;
    /**
     *

     * A schema in Avro JSON format.
     *

     */
    private String schema;
    /**
     *

     * The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify the
     * domain you chose when you created the Domain dataset group.
     *

     */
    private String domain;

    /**
     *

     * The name for the schema.
     *

     *
     * @param name
     *        The name for the schema.
     */

    public void setName(String name) {
        this.name = name;
    }

    /**
     *

     * The name for the schema.
     *

     *
     * @return The name for the schema.
     */

    public String getName() {
        return this.name;
    }

    /**
     *

     * The name for the schema.
     *

     *
     * @param name
     *        The name for the schema.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateSchemaRequest withName(String name) {
        setName(name);
        return this;
    }

    /**
     *

     * A schema in Avro JSON format.
     *

     *
     * @param schema
     *        A schema in Avro JSON format.
     */

    public void setSchema(String schema) {
        this.schema = schema;
    }

    /**
     *

     * A schema in Avro JSON format.
     *

     *
     * @return A schema in Avro JSON format.
     */

    public String getSchema() {
        return this.schema;
    }

    /**
     *

     * A schema in Avro JSON format.
     *

     *
     * @param schema
     *        A schema in Avro JSON format.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public CreateSchemaRequest withSchema(String schema) {
        setSchema(schema);
        return this;
    }

    /**
     *

     * The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify the
     * domain you chose when you created the Domain dataset group.
     *

     *
     * @param domain
     *        The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify
     *        the domain you chose when you created the Domain dataset group.
     * @see Domain
     */

    public void setDomain(String domain) {
        this.domain = domain;
    }

    /**
     *

     * The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify the
     * domain you chose when you created the Domain dataset group.
     *

     *
     * @return The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify
     *         the domain you chose when you created the Domain dataset group.
     * @see Domain
     */

    public String getDomain() {
        return this.domain;
    }

    /**
     *

     * The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify the
     * domain you chose when you created the Domain dataset group.
     *

     *
     * @param domain
     *        The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify
     *        the domain you chose when you created the Domain dataset group.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see Domain
     */

    public CreateSchemaRequest withDomain(String domain) {
        setDomain(domain);
        return this;
    }

    /**
     *

     * The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify the
     * domain you chose when you created the Domain dataset group.
     *

     *
     * @param domain
     *        The domain for the schema. If you are creating a schema for a dataset in a Domain dataset group, specify
     *        the domain you chose when you created the Domain dataset group.
     * @return Returns a reference to this object so that method calls can be chained together.
     * @see Domain
     */

    public CreateSchemaRequest withDomain(Domain domain) {
        this.domain = domain.toString();
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getName() != null)
            sb.append("Name: ").append(getName()).append(",");
        if (getSchema() != null)
            sb.append("Schema: ").append(getSchema()).append(",");
        if (getDomain() != null)
            sb.append("Domain: ").append(getDomain());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof CreateSchemaRequest == false)
            return false;
        CreateSchemaRequest other = (CreateSchemaRequest) obj;
        if (other.getName() == null ^ this.getName() == null)
            return false;
        if (other.getName() != null && other.getName().equals(this.getName()) == false)
            return false;
        if (other.getSchema() == null ^ this.getSchema() == null)
            return false;
        if (other.getSchema() != null && other.getSchema().equals(this.getSchema()) == false)
            return false;
        if (other.getDomain() == null ^ this.getDomain() == null)
            return false;
        if (other.getDomain() != null && other.getDomain().equals(this.getDomain()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getName() == null) ? 0 : getName().hashCode());
        hashCode = prime * hashCode + ((getSchema() == null) ? 0 : getSchema().hashCode());
        hashCode = prime * hashCode + ((getDomain() == null) ? 0 : getDomain().hashCode());
        return hashCode;
    }

    @Override
    public CreateSchemaRequest clone() {
        return (CreateSchemaRequest) super.clone();
    }

}


text:
package org.apache.jackrabbit.oak.plugins.index.lucene;

import org.apache.jackrabbit.oak.InitialContentHelper;
import org.apache.jackrabbit.oak.Oak;
import org.apache.jackrabbit.oak.api.ContentRepository;
import org.apache.jackrabbit.oak.plugins.index.IndexAggregationCommonTest;
import org.apache.jackrabbit.oak.plugins.index.LuceneIndexOptions;
import org.apache.jackrabbit.oak.plugins.index.aggregate.SimpleNodeAggregator;
import org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore;
import org.apache.jackrabbit.oak.spi.commit.Observer;
import org.apache.jackrabbit.oak.spi.query.QueryIndex;
import org.apache.jackrabbit.oak.spi.query.QueryIndexProvider;
import org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider;

import static com.google.common.collect.Lists.newArrayList;
import static org.apache.jackrabbit.JcrConstants.JCR_CONTENT;
import static org.apache.jackrabbit.JcrConstants.NT_FILE;
import static org.apache.jackrabbit.JcrConstants.NT_FOLDER;

public class LuceneIndexAggregationCommonTest extends IndexAggregationCommonTest {

    @Override
    protected ContentRepository createRepository() {
        indexOptions = new LuceneIndexOptions();
        LowCostLuceneIndexProvider provider = new LowCostLuceneIndexProvider();
        return new Oak(new MemoryNodeStore(InitialContentHelper.INITIAL_CONTENT))
                .with(new OpenSecurityProvider())
                .with((QueryIndexProvider) provider.with(getNodeAggregator()))
                .with((Observer) provider)
                .with(new LuceneIndexEditorProvider())
                .createContentRepository();
    }

    /**
     *
     * <aggregate primaryType="nt:file">
     * <include>jcr:content</include>
     * <include>jcr:content/*</include>
     * <include-property>jcr:content/jcr:lastModified</include-property>
     * </aggregate>
     *
     */
    private static QueryIndex.NodeAggregator getNodeAggregator() {
        return new SimpleNodeAggregator()
                .newRuleWithName(NT_FILE, newArrayList(JCR_CONTENT, JCR_CONTENT + "/*"))
                .newRuleWithName(NT_FOLDER, newArrayList("myFile", "subfolder/subsubfolder/file"));
    }

}


text:
class RemoveBusinessNameIndex < ActiveRecord::Migration
  def change
    remove_index :clients, :business_name
  end
end


text:
/*
This file is part of Highlight.

Highlight is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Highlight is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Highlight.  If not, see <http://www.gnu.org/licenses/>.
*/

#include <sstream>
#include "elementstyle.h"

namespace highlight
{

ElementStyle::ElementStyle (const Colour &col, bool b, bool i, bool u )
    : colour ( col ) , bold ( b ), italic ( i ), underline ( u )
{}

ElementStyle:: ElementStyle ( const string & elementStyleString )
    : bold ( false ), italic ( false ), underline ( false )
{
    set ( elementStyleString );
}

ElementStyle::ElementStyle()
    : bold ( false ), italic ( false ), underline ( false )
{}

void ElementStyle::set ( const string & elementStyleString )
{
    istringstream valueStream ( elementStyleString );
    string r, g, b, attr;

    char c='\0';
    valueStream >> c;

    if ( c=='#' ) {
        string htmlNotation;
        valueStream >> htmlNotation;
        if ( htmlNotation.size() < 6 ) return;
        r = htmlNotation.substr ( 0, 2 );
        g = htmlNotation.substr ( 2, 2 );
        b = htmlNotation.substr ( 4, 2 );
    } else {
        valueStream.putback ( c );
        valueStream >> r;
        valueStream >> g;
        valueStream >> b;
    }

    colour.setRed ( r );
    colour.setGreen ( g );
    colour.setBlue ( b );
    while ( valueStream >> attr ) {
        if ( attr=="italic" ) {
            italic = true;
        } else if ( attr=="bold" ) {
            bold = true;
        } else if ( attr=="underline" ) {
            underline = true;
        }
    }
}

ElementStyle::~ElementStyle()
{}

bool ElementStyle::isItalic() const
{
    return italic;
}
bool ElementStyle::isBold() const
{
    return bold;
}
bool ElementStyle::isUnderline() const
{
    return underline;
}
Colour ElementStyle::getColour() const
{
    return colour;
}

}


text:
            Contact Us

Website

Home

Features

Blog

Build it

Giveaway

Help

Downloads

External links

OsmAnd Facebook

OsmAnd Twitter

OsmAnd Github

Github Discussions (forum)

Get OsmAnd Merchandise

OsmAnd CZ Manuals

OpenStreetMap

Telegram - Chat

English

French

German

Italian

Russian

Ukrainian

Polish


text:
/* IE lte9 fixes */

/* main sidebar */
#sidebar_main {
    -ms-transform: translateX(-240px);
}
@media only screen and (max-width: 767px) {
    #sidebar_main {
        -ms-transform: translateY(-280px);
    }
}

.sidebar_main_active #sidebar_main,
.sidebar_main_open #sidebar_main {
    -ms-transform: translateY(0);
}

/* secondary sidebar */
#sidebar_secondary {
    -ms-transform: translateX(288px);
}

.sidebar_secondary_active #sidebar_secondary {
    -ms-transform: translateX(0);
}


text:
package android.support.v7.widget;

import android.content.Context;
import android.widget.LinearLayout;

public class LinearLayoutManager extends RecyclerView.LayoutManager {

	public LinearLayoutManager(Context ctx) {

	}

}


text:
- [Aastha Aneja](https://github.com/Aashu24/first-contributions.git)
- [Aravinth Natarajan](https://github.com/aravinth-itsme)
- [Simon Tite](https://github.com/simontite-capita-ti)
- [Chris Winsor](https://github.com/cwinsor)
- [ Dominic Valenciana](https://github.com/Kiricon)
- [Aswin Sanakan](https://github.com/aswinsanakan)
- [ shreya bhandare ]( https://github.com/shreab373 )
- [ Lord Adarsh ]( https://github.com/adarsh-why )
- [ Roshan Jossey ]( https://github.com/Roshanjossey )
- [Ujjwal](https://github.com/uforujjwal)
- [Shruthi](https://github.com/lakshmishruthi)
- [Tapan Prakash T](https://github.com/tapanprakasht)
- [Kamal Mohanan](https://github.com/kmlmhnn)
- [Ankit Raturi](https://github.com/ankitraturi)
- [Sarath S Menon](https://github.com/sarathsme)
- [Akhil Achuthan](https://github.com/akhilachu01)
- [Rony Cherian](https://github.com/phoe-nix-)
- [Angad Gill](https://github.com/angadgill92)
- [Adi](https://github.com/adityabhushan)
- [Rahul Rayaprolu](https://github.com/rahulr91)
- [Mukesh M](https://github.com/mukeshm)
- [Diego Gonzalez](https://github.com/luarca84)
- [MartenBE](https://github.com/MartenBE)
- [Jayakrishnan](https://github.com/JAYKRISHNAN)
- [EvanDCP](https://github.com/EvanDCP)
- [VinothKumar](https://github.com/Vinoth18)
- [HallLinux](https://github.com/HallLinux)
- [Jon Johnson](https://github.com/jonjohnson34)
- [Brandon Brigance](https://github.com/b-random)
- [Jaspreet Singh](https://github.com/singh19196)
- [ ajborka ]( https://www.github.com/ajborka )
- [Aravind](https://github.com/m-arav)
- [DORRITO](https://github.com/DORRITO)
- [seatownrocks](https://github.com/seatownrocks)
- [Chris Caldwell](https://github.com/ImmutableGlitch)
- [Palash Shah](https://github.com/palashshah)
- [raigon44](https://github.com/raigon44/)
- [thibmaek](https://github.com/thibmaek)
- [Shrut](https://github.com/shrut1996)
- [webgene](https://github.com/webgene)
- [solodynamo](https://github.com/solodynamo)
- [nicolas oppitz](https://github.com/nickoppitz)
- [wilgjah](https://github.com/wilkinv)
- [kamdz](https://github.com/kamdz)
- [Tran Ly Vu](https://github.com/tranlyvu)
- [Raghav Sethi](https://github.com/rghv96)
- [Sherfin Shamsudeen](https://github.com/sherfin94)
- [diego oppitz](https://github.com/diegooppitz)
- [Tom Lutzenberger](https://github.com/tomlutzenberger)
- [Rares Matei](https://github.com/rarmatei)
- [Aditya Vishwekar](https://github.com/adityavishwekar)
- [Eloisa Guerrero](https//github.com/grrrero)
- [Santhosh](https://github.com/sanreddevils)
- [Prakhar tripathi](https://github.com/Prakharsvnit)
- [Ji Wu](https://github.com/j1wu)
- [Sota Yamashita](https://github.com/sotayamashita)
- [Nishant Ranjan](https://github.com/darkfist)
- [Fakiolas Marios](https://github.com/fakiolinho)
- [Praful Singh](https://github.com/prafulSingh)
- [Rodrigo Cordova](https://github.com/Thrasheristico)
- [Samuel Hwang](https://github.com/samhwangg)
- [Denis Orehovsky](https://github.com/apirobot)
- [William Sutton](https://github.com/suttonwilliamd)
- [Pbaboe](https://github.com/Pbaboe)
- [Adarsh Lilha](https://github.com/adarshlilha)
- [Meghana](https://github.com/meMegna)
- [crawleya](https://github.com/crawleya)
- [sandeep](https://github.com/sandygit2201)
- [mrluissan](https://github.com/mrluissan)
- [ramseyjacob](https://github.com/ramseyjacob)
- [Nithin K Vijayan](https://github.com/nithin-vijayan)
- [Karan Deep Batra](https://github.com/krnbatra)
- [Shaznim Hussain](https://github.com/shaznimhussain)
- [Abhijeet Goel](https://github.com/aninjamonk)
- [Leticia Valderas](https://github.com/monaLeti)
- [Amar Yadav](https://github.com/amar-yadav)
- [Jimmy Mannan](https://github.com/jiimms)
- [Soroush Torkzadeh](https://github.com/sorousht)
- [Yuanyuan Sheng](https://github.com/yuanyuansheng)
- [Vipin Chacko](https://github.com/vipin7)
- [ivlv](https://github.com/ivlv)
- [Alvin Raygon](https://github.com/blackchalk)
- [Shiro Developer](https://github.com/shirodeveloper)
- [Ivan Stojanov](https://github.com/ivostojanov)
- [Rohan Gurjar](https://github.com/RohanGurjar)
- [Carlos Dias](https://github.com/carloscdias)
- [Lucas Martino](https://github.com/lucas95inc)
- [Alsendor Nucum (Draymond)](https://github.com/alsendor)
- [Alin Musat](https://github.com/alinbr)
- [Rajkumarsb](https://github.com/Rajkumarsb)
- [Anshul Chauhan](https://github.com/anshulnsit)
- [Steve Ford](https://github.com/d1sco)
- [Mike Chatsky](https://github.com/mikeChatsky)
- [Chris Ball](https://github.com/Balldy)
- [Rahul Malhotra](https://github.com/rahulmalhotra9620)
- [Sir Furness](https://github.com/SirFurness)
- [Ahmad W Khan](https://github.com/oli18)
- [organdonor86](https://github.com/organdonor86)
- [RocketSc](https://github.com/RocketSc)
- [WalidJlidi](https://github.com/walidjlidi)
- [Pratik6554](https://github.com/pratik6554)
- [hsk97](https://github.com/hsk97)
- [Mouath Ibrahim](https://github.com/iMouath)
- [Narendra Avula](https://github.com/narendradivi)
- [Christian Hansen](https://github.com/ChrisWcs)
- [Emil Plmkn](https://github.com/Plmkn)


text:
namespace google_youtube_api {
using namespace googleapis;

// Object factory method (static).
Thumbnail* Thumbnail::New() {
  return new client::JsonCppCapsule<Thumbnail>;
}

// Standard immutable constructor.
Thumbnail::Thumbnail(const Json::Value& storage)
  : client::JsonCppData(storage) {
}

// Standard mutable constructor.
Thumbnail::Thumbnail(Json::Value* storage)
  : client::JsonCppData(storage) {
}

// Standard destructor.
Thumbnail::~Thumbnail() {
}
}  // namespace google_youtube_api


text:
const assert = require('assert');
const filter = require('.');

function odd(x) {
  return x & 1;
}

const odds = filter(odd);

describe('arrays.filter(fn)(array)', function () {
  const input = [ 1, 2, 3, 4, 5, 6 ];

  it('should return a new array', function () {
    assert(odds(input) !== input);
  });

  it('should filter elements matching the predicate', function () {
    assert.deepEqual(odds(input), [ 1, 3, 5 ]);
  });
});


text:
require "rails_helper"

module Renalware::Drugs
  describe Drug, type: :model do
    subject(:drug) { build(:drug) }

    it :aggregate_failures do
      is_expected.to have_many(:classifications)
      is_expected.to have_many(:drug_types).through(:classifications)
      is_expected.to be_versioned
    end

    it_behaves_like "a Paranoid model"

    describe "destroy" do
      it "soft deletes the drug" do
        drug.save!
        expect { drug.destroy! }.to change(Drug, :count).by(-1)
        soft_deleted = Drug.with_deleted.find(drug.id)
        expect(soft_deleted).to eq(drug)
        expect(soft_deleted.deleted_at).not_to be_nil
      end
    end

    describe "assigning drug types to a drug" do
      it "can be assigned many unique drug types" do
        @antibiotic = create(:drug_type, code: "antibiotic", name: "Antibiotic")
        @esa = create(:drug_type, code: "esa", name: "ESA")

        drug.drug_types << @antibiotic
        drug.drug_types << @esa

        drug.save!
        drug.reload

        expect(drug.drug_types.size).to eq(2)

        expect(drug).to be_valid
      end
    end
  end
end


text:
package com.microsoft.live.test.util;

import java.util.concurrent.BlockingQueue;

import com.microsoft.live.LiveDownloadOperation;
import com.microsoft.live.LiveDownloadOperationListener;
import com.microsoft.live.LiveOperationException;

public class DownloadOperationQueueingListener extends QueueingListener<LiveDownloadOperation>
                                               implements LiveDownloadOperationListener {

    public DownloadOperationQueueingListener(BlockingQueue<LiveOperationException> exceptionQueue,
                                             BlockingQueue<LiveDownloadOperation> responseQueue) {
        super(exceptionQueue, responseQueue);
    }

    @Override
    public void onDownloadCompleted(LiveDownloadOperation operation) {
        this.responseQueue.add(operation);
    }

    @Override
    public void onDownloadFailed(LiveOperationException exception, LiveDownloadOperation operation) {
        this.exceptionQueue.add(exception);
        this.responseQueue.add(operation);
    }

    @Override
    public void onDownloadProgress(int totalBytes,
                                   int bytesRemaining,
                                   LiveDownloadOperation operation) {
        // TODO(skrueger): add support for progress
    }
}


text:
-- selectBindVariableNotFoundProperty.sql

select member.MEMBER_ID
     , member.MEMBER_NAME
     , (select sum(purchase.PURCHASE_PRICE)
          from PURCHASE purchase
         where purchase.MEMBER_ID = member.MEMBER_ID
           and purchase.PAYMENT_COMPLETE_FLG = 0
       ) as UNPAID_PRICE_SUMMARY
     , memberStatus.MEMBER_STATUS_NAME
  from MEMBER member
    left outer join MEMBER_STATUS memberStatus
      on member.MEMBER_STATUS_CODE = memberStatus.MEMBER_STATUS_CODE
 /*BEGIN*/where
   member.MEMBER_ID = /*pmb.wrongMemberId*/3
   /*IF pmb.memberName != null*/and member.MEMBER_NAME like /*pmb.memberName*/'ス' || '%'/*END*/
   /*IF pmb.memberStatusCode != null*/and member.MEMBER_STATUS_CODE = /*pmb.memberStatusCode*/'FML'/*END*/
   /*IF pmb.unpaidMemberOnly*/
   and exists (select 'yes'
                 from PURCHASE purchase
                where purchase.MEMBER_ID = member.MEMBER_ID
                  and purchase.PAYMENT_COMPLETE_FLG = 0
       )
   /*END*/
 /*END*/
 order by UNPAID_PRICE_SUMMARY desc, member.MEMBER_ID asc


text:
unless (Rails.env == 'production') || ENV['MEETUP_KEY']
  # raise "Copy config/api_keys.yml.sample to config/api_keys.yml and edit with your api key(s). :)"
  abort "Please define ENV['MEETUP_KEY'] before continuing."
end

unless (Rails.env == 'production') || ENV['AR4_S_K_B']
  abort "Please define ENV['AR4_S_K_B'] (Secret Key Base variable) before continuing."
end

class ApiCredentials
  cattr_accessor :all_keys
  def self.keys
    self.all_keys = ENV['MEETUP_KEY']
    # WAS: YAML::load(IO.read("#{Rails.root}/config/api_keys.yml"))
  end

  def self.key(service)
    return ENV[service] if ENV[service]
    keys[service]
  end
end


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is JavaScript Engine testing utilities.
 *
 * The Initial Developer of the Original Code is
 * Mozilla Foundation.
 * Portions created by the Initial Developer are Copyright (C) 2006
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s): Yuh-Ruey Chen
 *                 Brendan Eich
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

//-----------------------------------------------------------------------------
var BUGNUMBER = 321874;
var summary = 'lhs must be a reference in (for lhs in rhs) ...';
var actual = '';
var expect = '';
var section;

printBugNumber(BUGNUMBER);
printStatus (summary);

function a() {}
var b = {foo: 'bar'};

printStatus('for-in tests');

var v;
section = summary + ': for((v) in b);';
expect = 'foo';
printStatus(section);
try
{
  eval('for ((v) in b);');
  actual = v;
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, section);

section = summary + ': function foo(){for((v) in b);};foo();';
expect = 'foo';
printStatus(section);
try
{
  eval('function foo(){ for ((v) in b);}; foo();');
  actual = v;
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, section);

section = summary + ': for(a() in b);';
expect = 'error';
printStatus(section);
try
{
  eval('for (a() in b);');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, section);

section = summary + ': function foo(){for(a() in b);};foo();';
expect = 'error';
printStatus(section);
try
{
  eval('function foo(){ for (a() in b);};foo();');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, section);

section = ': for(new a() in b);';
expect = 'error';
printStatus(section);
try
{
  eval('for (new a() in b);');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

section = ': function foo(){for(new a() in b);};foo();';
expect = 'error';
printStatus(section);
try
{
  eval('function foo(){ for (new a() in b);};foo();');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

section = ': for(void in b);';
expect = 'error';
printStatus(section);
try
{
  eval('for (void in b);');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

section = ': function foo(){for(void in b);};foo();';
expect = 'error';
printStatus(section);
try
{
  eval('function foo(){ for (void in b);};foo();');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

var d = 1;
var e = 2;
expect = 'error';
section = ': for((d*e) in b);';
printStatus(section);
try
{
  eval('for ((d*e) in b);');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

var d = 1;
var e = 2;
expect = 'error';
section = ': function foo(){for((d*e) in b);};foo();';
printStatus(section);
try
{
  eval('function foo(){ for ((d*e) in b);};foo();');
  actual = 'no error';
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

const c = 0;
expect = 0;
section = ': for(c in b);';
printStatus(section);
try
{
  eval('for (c in b);');
  actual = c;
  printStatus('typeof c: ' + (typeof c) + ', c: ' + c);
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);

expect = 0;
section = ': function foo(){for(c in b);};foo();';
printStatus(section);
try
{
  eval('function foo(){ for (c in b);};foo();');
  actual = c;
  printStatus('typeof c: ' + (typeof c) + ', c: ' + c);
}
catch(ex)
{
  printStatus(ex+'');
  actual = 'error';
}
reportCompare(expect, actual, summary + section);


text:
set -e

dir="$(dirname "$(readlink -f "$BASH_SOURCE")")"

self="$(basename "$0")"

usage() {
	cat <<EOUSAGE

usage: $self [-t test ...] image:tag [...]
   ie: $self debian:stretch
       $self -t utc python:3
       $self -t utc python:3 -t python-hy

This script processes the specified Docker images to test their running
environments.
EOUSAGE
}

# arg handling
opts="$(getopt -o 'ht:c:?' --long 'dry-run,help,test:,config:,keep-namespace' -- "$@" || { usage >&2 && false; })"
eval set -- "$opts"

declare -A argTests=()
declare -a configs=()
dryRun=
keepNamespace=
while true; do
	flag=$1
	shift
	case "$flag" in
		--dry-run) dryRun=1 ;;
		--help|-h|'-?') usage && exit 0 ;;
		--test|-t) argTests["$1"]=1 && shift ;;
		--config|-c) configs+=("$(readlink -f "$1")") && shift ;;
		--keep-namespace) keepNamespace=1 ;;
		--) break ;;
		*)
			{
				echo "error: unknown flag: $flag"
				usage
			} >&2
			exit 1
			;;
	esac
done

if [ $# -eq 0 ]; then
	usage >&2
	exit 1
fi

# declare configuration variables
declare -a globalTests=()
declare -A testAlias=()
declare -A imageTests=()
declare -A globalExcludeTests=()
declare -A explicitTests=()

# if there are no user-specified configs, use the default config
if [ ${#configs} -eq 0 ]; then
	configs+=("$dir/config.sh")
fi

# load the configs
declare -A testPaths=()
for conf in "${configs[@]}"; do
	. "$conf"

	# Determine the full path to any newly-declared tests
	confDir="$(dirname "$conf")"

	for testName in ${globalTests[@]} ${imageTests[@]}; do
		[ "${testPaths[$testName]}" ] && continue

		if [ -d "$confDir/tests/$testName" ]; then
			# Test directory found relative to the conf file
			testPaths[$testName]="$confDir/tests/$testName"
		elif [ -d "$dir/tests/$testName" ]; then
			# Test directory found in the main tests/ directory
			testPaths[$testName]="$dir/tests/$testName"
		fi
	done
done

didFail=
for dockerImage in "$@"; do
	echo "testing $dockerImage"

	if ! docker inspect "$dockerImage" &> /dev/null; then
		echo $'\timage does not exist!'
		didFail=1
		continue
	fi

	repo="${dockerImage%:*}"
	tagVar="${dockerImage#*:}"
	#version="${tagVar%-*}"
	variant="${tagVar##*-}"

	case "$tagVar" in
		*onbuild*)
			# "maven:onbuild-alpine" is still onbuild
			# ONCE ONBUILD, ALWAYS ONBUILD
			variant='onbuild'
			;;
		*fpm-*)
			# lolPHP
			variant='fpm'
			;;
		*alpine*)
			# "alpine3.4", "alpine3.6", "nginx:alpine-perl", etc are still "alpine" variants
			variant='alpine'
			;;
		slim-*|*-slim-*)
			# "slim-jessie" is still "slim"
			variant='slim'
			;;
	esac

	testRepo="$repo"
	if [ -z "$keepNamespace" ]; then
		testRepo="${testRepo##*/}"
	fi
	[ -z "${testAlias[$repo]}" ] || testRepo="${testAlias[$repo]}"

	explicitVariant=
	if [ \
		"${explicitTests[:$variant]}" \
		-o "${explicitTests[$repo:$variant]}" \
		-o "${explicitTests[$testRepo:$variant]}" \
	]; then
		explicitVariant=1
	fi

	testCandidates=()
	if [ -z "$explicitVariant" ]; then
		testCandidates+=( "${globalTests[@]}" )
	fi
	testCandidates+=(
		${imageTests[:$variant]}
	)
	if [ -z "$explicitVariant" ]; then
		testCandidates+=(
			${imageTests[$testRepo]}
		)
	fi
	testCandidates+=(
		${imageTests[$testRepo:$variant]}
	)
	if [ "$testRepo" != "$repo" ]; then
		if [ -z "$explicitVariant" ]; then
			testCandidates+=(
				${imageTests[$repo]}
			)
		fi
		testCandidates+=(
			${imageTests[$repo:$variant]}
		)
	fi

	tests=()
	for t in "${testCandidates[@]}"; do
		if [ ${#argTests[@]} -gt 0 -a -z "${argTests[$t]}" ]; then
			# skipping due to -t
			continue
		fi

		if [ \
			! -z "${globalExcludeTests[${testRepo}_$t]}" \
			-o ! -z "${globalExcludeTests[${testRepo}:${variant}_$t]}" \
			-o ! -z "${globalExcludeTests[:${variant}_$t]}" \
			-o ! -z "${globalExcludeTests[${repo}_$t]}" \
			-o ! -z "${globalExcludeTests[${repo}:${variant}_$t]}" \
			-o ! -z "${globalExcludeTests[:${variant}_$t]}" \
		]; then
			# skipping due to exclude
			continue
		fi

		tests+=( "$t" )
	done

	currentTest=0
	totalTest="${#tests[@]}"
	for t in "${tests[@]}"; do
		(( currentTest+=1 ))
		echo -ne "\t'$t' [$currentTest/$totalTest]..."

		# run test against dockerImage here
		# find the script for the test
		scriptDir="${testPaths[$t]}"
		if [ -d "$scriptDir" ]; then
			script="$scriptDir/run.sh"
			if [ -x "$script" -a ! -d "$script" ]; then
				# TODO dryRun logic
				if output="$("$script" $dockerImage)"; then
					if [ -f "$scriptDir/expected-std-out.txt" ] && ! d="$(echo "$output" | diff -u "$scriptDir/expected-std-out.txt" - 2>/dev/null)"; then
						echo 'failed; unexpected output:'
						echo "$d"
						didFail=1
					else
						echo 'passed'
					fi
				else
					echo 'failed'
					didFail=1
				fi
			else
				echo "skipping"
				echo >&2 "error: $script missing, not executable or is a directory"
				didFail=1
				continue
			fi
		else
			echo "skipping"
			echo >&2 "error: unable to locate test '$t'"
			didFail=1
			continue
		fi
	done
done

if [ "$didFail" ]; then
	exit 1
fi


text:
<?php
require_once 'wincache_base9.php';
?>


text:
============================
NetRNG
============================

.. image:: https://travis-ci.org/infincia/NetRNG.svg?branch=master
    :target: https://travis-ci.org/infincia/NetRNG

**Note: The master branch of this code is alpha quality but usable**.

NetRNG is effectively a network connected hardware random number generator.

It allows devices like the RaspberryPi, Beaglebone, or any machine with a TPM,
Entropy Key, or other hardware random number generator onboard to act as a NetRNG
server, providing high quality random data to other machines on the network.

Virtual machines can potentially benefit the most from NetRNG, as they typically
suffer from poor quality local entropy sources due to their running environment.

No application or kernel changes are required on NetRNG Client machines; any
application using ``/dev/random`` and ``/dev/urandom`` will automatically and
transparently receive entropy from the NetRNG server.

Why it exists
-------------

EntropyBroker is the closest similar project I know of, but it didn't build when I
tried to use it, and the code seems quite large and complicated for a task that,
conceptually, is very simple.

So I wrote NetRNG. It's simple code, easy to maintain, easy to deploy, and with
the exception of some network protocol issues before v0.1, it works quite
well.

How it works
------------

As a complete system, NetRNG links ``/dev/hwrng`` on one machine, to ``/dev/random``
on many others, carefully ensuring that each machine receives unique entropy samples,
while allowing the entropy to be validated for quality and ensuring that entropy
is fairly distributed among connected clients.

It is essentially a persistent pipeline from one machine to many others, with
some minor restrictions on how the pipeline functions to make it suitable for the
task.

However, NetRNG itself does one job and only one job: it moves random data
around on the local network. Other tasks like validating the samples and providing
them to the kernel entropy pool are left to ``rngd`` from rng-tools, which is
automatically started and managed by NetRNG.

Server
------

The NetRNG server reads from ``/dev/hwrng`` (configurable), dividing up the stream
in to non-repeating, non-overlapping samples of a size defined in the configuration
file, then sends each one to clients on the local network.

The maximum number of clients that will be accepted can be configured on the server,
this allows you to prevent a slow HWRNG from being spread too thin among too many
clients.

I'm working on a QoS style load management system that will allow you to guarantee
that each connected client can receive entropy samples at a specific rate, 10KB/s
for example. Clients would be allowed to connect until the server could no longer
guarantee that entropy rate to each of them.

Client
------

The client starts ``rngd`` from rng-tools as a subprocess, then connects to the
server and starts requesting entropy samples from it. Then each sample is forwarded
to ``rngd`` for processing.

Then, ``rngd`` validates the quality of the entropy sample before submitting it to
the Linux or FreeBSD kernel for other programs to use via ``/dev/random``.

Common devices to use as the NetRNG server
------------------------------------------

* RaspberryPi
* Beaglebone
* PC Engines ALIX
* Various server mainboards
* Any machine with a TPM chip onboard
* Any machine with an Entropy Key

Setup
-----

There is very little actual configuration required for NetRNG, it is packaged
on PyPi as a universal wheel, and can be installed with ``pip``.

Feel free to install it wherever you like, but ``/opt/NetRNG`` is where the
bundled init/upstart script point, so if you install somewhere else make sure to
change them after copying to the proper location in ``/etc/``.

I don't advise installing the package in the global Python installation, but you
can if you want to. If possible just use a virtualenv to make things easier :)

Note: these instructions are written for Debian/Ubuntu and derivatives, you'll
need to determine the equivalent native package names for build-essential and
python-dev.

The virtualenv activation is repeated on purpose in certain steps to ensure that
someone who isn't following the steps sequentially won't accidentally install
python modules in the global system (not being root helps here, but just in
case...).

Create virtualenv
-----------------

Create a virtualenv for NetRNG:

.. code-block:: shell

    virtualenv /opt/NetRNG

Setup build environment
-----------------------

Some NetRNG dependencies require building Python C extensions, a compiler and
Python development headers are needed so they'll build properly:

.. code-block:: shell

    apt-get install build-essential
    apt-get install python-dev

The `wheel` module is also needed to build NetRNG, so make sure it is installed
in the virtualenv:

.. code-block:: shell

    source /opt/NetRNG/bin/activate
    pip install wheel

Install NetRNG
--------------

.. code-block:: shell

    source /opt/NetRNG/bin/activate
    pip install netrng

Install rng-tools
-----------------

On some Linux distributions, rng-tools is installed by default. For others you
will need to install it yourself.

On Ubuntu or Debian you can install it like this:

.. code-block:: shell

    sudo apt-get install rng-tools

Configuration
-------------

Copy the sample config file:

.. code-block:: shell

    cp /opt/NetRNG/conf/netrng.conf.sample /etc/netrng.conf

NetRNG requires very little configuration on most systems.

The ``listen_address`` must be set correctly on the Server, and ``server_address``
must be set correctly on the client if Zeroconf is disabled.

Zeroconf
--------

Zeroconf is enabled by default in the configuration file, just make sure to set
the  ``listen_address`` correctly on the server.

The client will ignore the ``server_address`` setting when Zeroconf is enabled.

Run for testing
---------------

Since the compiled daemon script is available on your path while the virtualenv
is activated, you can run it directly after the config file is determined to be
correct:

.. code-block:: shell

    source /opt/NetRNG/bin/activate
    netrngd

Long term use
-------------

I have written both Upstart and systemd scripts for netrngd.

If someone would like to contribute other types of init scripts I will gladly
accept a pull request.

To use the the systemd script:

.. code-block:: shell

    cp /opt/NetRNG/conf/netrng.service /etc/systemd/system/
    systemctl daemon-reload
    systemctl start netrng

To use the Upstart script:

.. code-block:: shell

    cp /opt/NetRNG/conf/netrng.conf.upstart /etc/init/netrng.conf
    service netrng start


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/toast_message"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@drawable/custom_toast_bg"
        android:gravity="center"
        android:textColor="@color/white"
        android:textSize="15sp" />

</LinearLayout>


text:
module RbProject
  require 'rb_project/version.rb'
end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package app.metatron.discovery.query.druid.aggregations;

import com.fasterxml.jackson.annotation.JsonTypeName;

import javax.validation.constraints.NotNull;

import app.metatron.discovery.query.druid.Aggregation;

@JsonTypeName("approxHistogram")
public class ApproxHistogramAggregation implements Aggregation {

  @NotNull
  String name;

  @NotNull
  String fieldName;

  Integer resolution;

  Integer numBuckets;

  Float lowerLimit;

  Float upperLimit;

  public ApproxHistogramAggregation(@NotNull String name, @NotNull String fieldName) {
    this.name = name;
    this.fieldName = fieldName;
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getFieldName() {
    return fieldName;
  }

  public void setFieldName(String fieldName) {
    this.fieldName = fieldName;
  }

  public Integer getResolution() {
    return resolution;
  }

  public void setResolution(Integer resolution) {
    this.resolution = resolution;
  }

  public Integer getNumBuckets() {
    return numBuckets;
  }

  public void setNumBuckets(Integer numBuckets) {
    this.numBuckets = numBuckets;
  }

  public Float getLowerLimit() {
    return lowerLimit;
  }

  public void setLowerLimit(Float lowerLimit) {
    this.lowerLimit = lowerLimit;
  }

  public Float getUpperLimit() {
    return upperLimit;
  }

  public void setUpperLimit(Float upperLimit) {
    this.upperLimit = upperLimit;
  }

  @Override
  public String toString() {
    return "ApproxHistogramAggregation{" +
            "name='" + name + '\'' +
            ", fieldName='" + fieldName + '\'' +
            '}';
  }

}