text:
.class Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicLocale;
.super Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicImpl;
.source "TextDirectionHeuristicsCompat.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/support/v4/text/TextDirectionHeuristicsCompat;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "TextDirectionHeuristicLocale"
.end annotation

# static fields
.field public static final INSTANCE:Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicLocale;

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 254
    new-instance v0, Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicLocale;

    invoke-direct {v0}, Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicLocale;-><init>()V

    sput-object v0, Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicLocale;->INSTANCE:Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicLocale;

    return-void
.end method

.method public constructor <init>()V
    .locals 1

    .prologue
    .line 245
    const/4 v0, 0x0

    invoke-direct {p0, v0}, Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionHeuristicImpl;-><init>(Landroid/support/v4/text/TextDirectionHeuristicsCompat$TextDirectionAlgorithm;)V

    .line 246
    return-void
.end method

# virtual methods
.method protected defaultIsRtl()Z
    .locals 3

    .prologue
    const/4 v1, 0x1

    .line 250
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object v2

    invoke-static {v2}, Landroid/support/v4/text/TextUtilsCompat;->getLayoutDirectionFromLocale(Ljava/util/Locale;)I

    move-result v0

    .line 251
    .local v0, "dir":I
    if-ne v0, v1, :cond_0

    :goto_0
    return v1

    :cond_0
    const/4 v1, 0x0

    goto :goto_0
.end method


text:
#include "tensorflow/cc/framework/grad_op_registry.h"
#include "tensorflow/cc/framework/gradient_checker.h"
#include "tensorflow/cc/framework/testutil.h"
#include "tensorflow/cc/gradients/grad_testutil.h"
#include "tensorflow/cc/ops/standard_ops.h"
#include "tensorflow/core/framework/tensor_testutil.h"
#include "tensorflow/core/lib/core/status_test_util.h"
#include "tensorflow/core/lib/random/random.h"

namespace tensorflow {
using namespace ops;  // NOLINT(build/namespaces)

namespace {

class NNGradTest : public ::testing::Test {
 protected:
  NNGradTest() : scope_(Scope::NewRootScope()) {}

  void RunTest(const Output& x, const TensorShape& x_shape, const Output& y,
               const TensorShape& y_shape) {
    float max_error;
    TF_ASSERT_OK(ComputeGradientError(scope_, {x}, {x_shape}, {y}, {y_shape},
                                      &max_error));
    EXPECT_LT(max_error, 2e-4);
  }

  void RunTest(const Output& x, const Tensor& x_init_value, const Output& y,
               const TensorShape& y_shape) {
    float max_error;
    TF_ASSERT_OK(
        ComputeGradientError(scope_, x, x_init_value, y, y_shape, &max_error));
    EXPECT_LT(max_error, 2e-4);
  }

  void RunTest(const OutputList& xs, const std::vector<TensorShape>& x_shapes,
               const OutputList& ys, const std::vector<TensorShape>& y_shapes) {
    TF_ASSERT_OK(scope_.status());
    float max_error;
    TF_ASSERT_OK(
        ComputeGradientError(scope_, xs, x_shapes, ys, y_shapes, &max_error));
    EXPECT_LT(max_error, 2e-4);
  }

  Scope scope_;
};

TEST_F(NNGradTest, SoftmaxGrad) {
  TensorShape shape({32, 10});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto y = Softmax(scope_, x);
  RunTest(x, shape, y, shape);
}

TEST_F(NNGradTest, LogSoftmaxGrad) {
  TensorShape shape({5, 3});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto y = LogSoftmax(scope_, x);
  // Avoid numerical instability when computing finite differences.
  Tensor x_init_value = test::AsTensor<float>(
          {-0.9f, -0.7f, -0.5f, -0.3f, -0.1f,
           0.1f, 0.3f, 0.5f, 0.7f, 0.8f,
           -0.1f, 0.1f, 0.1f, 0.1f, 1.2f},
          {5, 3});
  RunTest(x, x_init_value, y, shape);
}

TEST_F(NNGradTest, ReluGrad) {
  TensorShape shape({5, 2});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto y = Relu(scope_, x);
  // Avoid input values where ReLU gradient is not well defined (around zero).
  Tensor x_init_value = test::AsTensor<float>(
      {-0.9f, -0.7f, -0.5f, -0.3f, -0.1f, 0.1f, 0.3f, 0.5f, 0.7f, 0.9f},
      {5, 2});
  RunTest(x, x_init_value, y, shape);
}

TEST_F(NNGradTest, Relu6Grad) {
  TensorShape shape({5, 2});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto y = Relu6(scope_, x);
  // Avoid input values where ReLU gradient is not well defined (around zero
  // and six).
  Tensor x_init_value = test::AsTensor<float>(
      {-0.9f, -0.7f, -0.5f, -0.3f, -0.1f, 6.1f, 6.3f, 6.5f, 6.7f, 6.9f},
      {5, 2});
  RunTest(x, x_init_value, y, shape);
}

TEST_F(NNGradTest, EluGrad) {
  TensorShape shape({5, 2});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto y = Elu(scope_, x);
  Tensor x_init_value = test::AsTensor<float>(
      {-0.9f, -0.7f, -0.5f, -0.3f, -0.1f, 0.1f, 0.3f, 0.5f, 0.7f, 0.9f},
      {5, 2});
  RunTest(x, x_init_value, y, shape);
}

TEST_F(NNGradTest, SeluGrad) {
  TensorShape shape({5, 2});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto y = Selu(scope_, x);
  Tensor x_init_value = test::AsTensor<float>(
      {-0.9f, -0.7f, -0.5f, -0.3f, -0.1f, 0.1f, 0.3f, 0.5f, 0.7f, 0.9f},
      {5, 2});
  RunTest(x, x_init_value, y, shape);
}

TEST_F(NNGradTest, L2LossGrad) {
  TensorShape x_shape({5, 2});
  TensorShape y_shape({1});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(x_shape));
  auto y = L2Loss(scope_, x);
  RunTest(x, x_shape, y, y_shape);
}

TEST_F(NNGradTest, BiasAddGradHelper) {
  TensorShape shape({4, 5});
  TensorShape bias_shape({5});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  auto bias = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(bias_shape));
  auto y = BiasAdd(scope_, x, bias);
  RunTest({x,bias}, {shape, bias_shape}, {y}, {shape});
}

TEST_F(NNGradTest, Conv2DGrad) {
  TensorShape shape({1, 2, 2, 1});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  Tensor filter = test::AsTensor<float>({0.5f}, {1, 1, 1, 1});
  const std::vector<int> strides{1, 1, 1, 1};
  auto y = Conv2D(scope_, x, filter, strides, "SAME");
  RunTest(x, shape, y, shape);
}

TEST_F(NNGradTest, MaxPoolGradHelper) {
  TensorShape shape({1, 2, 2, 1});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  const std::vector<int> ksize{1, 2, 2, 1};
  const std::vector<int> strides{1, 1, 1, 1};
  auto y = MaxPool(scope_, x, ksize, strides, "SAME");
  RunTest(x, shape, y, shape);
}

TEST_F(NNGradTest, MaxPoolGradV2Helper) {
  TensorShape shape({1, 2, 2, 1});
  auto x = Placeholder(scope_, DT_FLOAT, Placeholder::Shape(shape));
  Tensor ksize = test::AsTensor<int>({1, 2, 2, 1}, {4});
  Tensor strides = test::AsTensor<int>({1, 1, 1, 1}, {4});
  auto y = MaxPoolV2(scope_, x, ksize, strides, "SAME");
  RunTest(x, shape, y, shape);
}

}  // namespace
}  // namespace tensorflow

redpajama_set_name: RedPajamaGithub


text:
class Mapper0 {
public:
    void load(Cartridge* cartridge);

    uint8_t read(const uint16_t& address);
    void write(const uint16_t& address, const uint8_t& value);

private:
    Cartridge* cart;

    //std::vector<uint_t> chr_ram; // 0x2000

    int prg_mirrored;
    //bool uses_chr_ram;
};


text:
mysql -u root holmes -e "DELETE FROM facts WHERE review_id IN (
    SELECT DISTINCT id FROM reviews WHERE page_id in (
        SELECT DISTINCT id FROM pages WHERE domain_id = $1
    )
);

DELETE FROM violations WHERE review_id IN (
    SELECT DISTINCT id FROM reviews WHERE page_id in (
        SELECT DISTINCT id FROM pages WHERE domain_id = $1
    )
);

UPDATE pages SET last_review_id=null where domain_id = $1;

DELETE FROM reviews WHERE page_id in (
    SELECT DISTINCT id FROM pages WHERE domain_id = $1
);

DELETE FROM pages WHERE domain_id = $1;
DELETE FROM domains WHERE id = $1;
"


text:
/*global angular */
(function () {
    'use strict';

    function FileAttachmentDemoController($scope) {
        var vm = this;

        function removeFromArray(items, obj) {
            var i,
                n;

            if (items) {
                for (i = 0, n = items.length; i < n; i++) {
                    if (items[i] === obj) {
                        items.splice(i, 1);
                        break;
                    }
                }
            }
        }

        vm.attachments = [];
        vm.links = [];
        vm.rejected = [];
        vm.allItems = [];
        vm.singleFile = null;

        vm.fileDropped = function (files, rejectedFiles) {
            vm.attachments = vm.attachments.concat(files);
            vm.allItems = vm.allItems.concat(files);
            vm.rejected = rejectedFiles;
        };

        vm.fileLinked = function (link) {
            vm.links.push(link);
            vm.allItems.push(link);
        };

        vm.deleteAttachment = function (file) {
            removeFromArray(vm.links, file);
            removeFromArray(vm.attachments, file);
            removeFromArray(vm.allItems, file);
        };

        vm.fileValidate = function (file) {
            if (file.name.indexOf('a') === 0) {
                return 'You may not upload a file that begins with the letter "a."';
            }
        };

        vm.fileChange = function (file, rejectedFiles) {
            if (file) {
                vm.fileDropped([file], rejectedFiles);
            } else {
                vm.fileDropped([], rejectedFiles);
            }
        };

        vm.fileLinkAction = function () {
            alert(vm.singleFile.name);
        };

        $scope.$watch(function () {
            return vm.alertClosed;
        }, function () {
            if (vm.alertClosed) {
                vm.rejected = null;
                vm.alertClosed = false;
            }
        });
    }

    FileAttachmentDemoController.$inject = ['$scope'];

    angular.module('stache')
        .controller('FileAttachmentDemoController', FileAttachmentDemoController);

}());


text:
namespace mscorlib
{
	namespace System
	{

		class Type;

	}
}
namespace mscorlib
{
	namespace System
	{
		namespace Security
		{
			namespace Cryptography
			{

				class RNGCryptoServiceProvider
					: public mscorlib::System::Security::Cryptography::RandomNumberGenerator
					, public virtual mscorlib::System::IDisposable
				{
				public:
					RNGCryptoServiceProvider()
					: mscorlib::System::Security::Cryptography::RandomNumberGenerator(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.Cryptography.RNGCryptoServiceProvider"))
					, mscorlib::System::IDisposable(NULL)
					{
						__native_object__ = Global::New("mscorlib", "System.Security.Cryptography", "RNGCryptoServiceProvider");
					};

					RNGCryptoServiceProvider(std::vector<mscorlib::System::Byte*> rgb)
					: mscorlib::System::Security::Cryptography::RandomNumberGenerator(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.Cryptography.RNGCryptoServiceProvider"))
					, mscorlib::System::IDisposable(NULL)
					{
						MonoType *__parameter_types__[1];
						void *__parameters__[1];
						__parameter_types__[0] = mono_class_get_type(mono_array_class_get(mono_class_from_mono_type(Global::GetType("mscorlib", "System", "Byte")), 1));
						__parameters__[0] = Global::FromArray<mscorlib::System::Byte*>(rgb, "mscorlib", "System", "Byte");
						__native_object__ = Global::New("mscorlib", "System.Security.Cryptography", "RNGCryptoServiceProvider", 1, __parameter_types__, __parameters__);
					};

					RNGCryptoServiceProvider(mscorlib::System::Security::Cryptography::CspParameters cspParams)
					: mscorlib::System::Security::Cryptography::RandomNumberGenerator(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.Cryptography.RNGCryptoServiceProvider"))
					, mscorlib::System::IDisposable(NULL)
					{
						MonoType *__parameter_types__[1];
						void *__parameters__[1];
						__parameter_types__[0] = Global::GetType("mscorlib", "System.Security.Cryptography", "CspParameters");
						__parameters__[0] = (MonoObject*)cspParams;
						__native_object__ = Global::New("mscorlib", "System.Security.Cryptography", "RNGCryptoServiceProvider", 1, __parameter_types__, __parameters__);
					};

					RNGCryptoServiceProvider(mscorlib::System::String str)
					: mscorlib::System::Security::Cryptography::RandomNumberGenerator(mscorlib::NativeTypeInfo::GetTypeInfo("mscorlib","System.Security.Cryptography.RNGCryptoServiceProvider"))
					, mscorlib::System::IDisposable(NULL)
					{
						MonoType *__parameter_types__[1];
						void *__parameters__[1];
						__parameter_types__[0] = Global::GetType("mscorlib", "System", "String");
						__parameters__[0] = (MonoObject*)str;
						__native_object__ = Global::New("mscorlib", "System.Security.Cryptography", "RNGCryptoServiceProvider", 1, __parameter_types__, __parameters__);
					};

					RNGCryptoServiceProvider(mscorlib::NativeTypeInfo *nativeTypeInfo)
					: mscorlib::System::Security::Cryptography::RandomNumberGenerator(nativeTypeInfo)
					, mscorlib::System::IDisposable(NULL)
					{
					};

					RNGCryptoServiceProvider(MonoObject *nativeObject)
					: mscorlib::System::Security::Cryptography::RandomNumberGenerator(nativeObject)
					, mscorlib::System::IDisposable(nativeObject)
					{
					};

					~RNGCryptoServiceProvider()
					{
					};

					RNGCryptoServiceProvider & operator=(RNGCryptoServiceProvider &value) { __native_object__ = value.GetNativeObject(); return value; };
					bool operator==(RNGCryptoServiceProvider &value) { return mscorlib::System::Object::Equals(value); };
					operator MonoObject*() { return __native_object__; };
					MonoObject* operator=(MonoObject* value) { return __native_object__ = value; };

					virtual void  GetBytes(std::vector<mscorlib::System::Byte*> data) override;
					virtual void  GetNonZeroBytes(std::vector<mscorlib::System::Byte*> data) override;
					virtual MonoObject* GetNativeObject()  override  { return __native_object__; };

				protected:

				private:

				};

			}
		}
	}
}
#endif


text:
import React from 'react';
import {
    AppRegistry,
    asset,
    Pano,
    Text,
    View,
    Plane,

} from 'react-vr';

export default class Navbar extends React.Component {

    constructor(props) {
        super(props);
    }

    render() {

        // var children = this.props.children.map(function(item, i) {
        //     return React.addons.cloneWithProps(item, {
        //         isSelected: isSelected,
        //         selectItem: this.selectItem,
        //         key: item.props.key
        //     });
        // }, this);

        return (
            //Note changing row to column

            <View style={{
                    display:  'flex',
                    flex: 0,
                    flexWrap: 'wrap',
                    flexDirection: 'row',
                    alignItems: 'stretch',
                    height: 0.5,
                    backgroundColor: "#0275d8"
                  }}>

                {this.props.children}

            </View>

        );
    }
};


text:
import mock
from oslo_utils import uuidutils
from oslo_versionedobjects import fields as obj_fields
from oslo_versionedobjects import fixture
import testtools

from neutron.api.rpc.callbacks import resources
from neutron.api.rpc.callbacks import version_manager
from neutron.api.rpc.handlers import resources_rpc
from neutron.common import topics
from neutron import context
from neutron.objects import base as objects_base
from neutron.tests import base

TEST_EVENT = 'test_event'
TEST_VERSION = '1.0'

def _create_test_dict(uuid=None):
    return {'id': uuid or uuidutils.generate_uuid(),
            'field': 'foo'}

def _create_test_resource(context=None, resource_cls=None):
    resource_cls = resource_cls or FakeResource
    resource_dict = _create_test_dict()
    resource = resource_cls(context, **resource_dict)
    resource.obj_reset_changes()
    return resource

class BaseFakeResource(objects_base.NeutronObject):
    @classmethod
    def get_objects(cls, context, **kwargs):
        return list()

class FakeResource(BaseFakeResource):
    VERSION = TEST_VERSION

    fields = {
        'id': obj_fields.UUIDField(),
        'field': obj_fields.StringField()
    }

class FakeResource2(BaseFakeResource):
    VERSION = TEST_VERSION

    fields = {
        'id': obj_fields.UUIDField(),
        'field': obj_fields.StringField()
    }

class ResourcesRpcBaseTestCase(base.BaseTestCase):

    def setUp(self):
        super(ResourcesRpcBaseTestCase, self).setUp()

        self.obj_registry = self.useFixture(
            fixture.VersionedObjectRegistryFixture())

        self.context = context.get_admin_context()
        mock.patch.object(resources_rpc.resources,
                          'is_valid_resource_type').start()
        mock.patch.object(resources_rpc.resources, 'get_resource_cls',
                          side_effect=self._get_resource_cls).start()

        self.resource_objs = [_create_test_resource(self.context)
                              for _ in range(2)]
        self.resource_objs2 = [_create_test_resource(self.context,
                                                     FakeResource2)
                               for _ in range(2)]

    @staticmethod
    def _get_resource_cls(resource_type):
        return {FakeResource.obj_name(): FakeResource,
                FakeResource2.obj_name(): FakeResource2}.get(resource_type)

class _ValidateResourceTypeTestCase(base.BaseTestCase):
    def setUp(self):
        super(_ValidateResourceTypeTestCase, self).setUp()
        self.is_valid_mock = mock.patch.object(
            resources_rpc.resources, 'is_valid_resource_type').start()

    def test_valid_type(self):
        self.is_valid_mock.return_value = True
        resources_rpc._validate_resource_type('foo')

    def test_invalid_type(self):
        self.is_valid_mock.return_value = False
        with testtools.ExpectedException(
                resources_rpc.InvalidResourceTypeClass):
            resources_rpc._validate_resource_type('foo')

class _ResourceTypeVersionedTopicTestCase(base.BaseTestCase):

    @mock.patch.object(resources_rpc, '_validate_resource_type')
    def test_resource_type_versioned_topic(self, validate_mock):
        obj_name = FakeResource.obj_name()
        expected = topics.RESOURCE_TOPIC_PATTERN % {
            'resource_type': 'FakeResource', 'version': '1.0'}
        with mock.patch.object(resources_rpc.resources, 'get_resource_cls',
                return_value=FakeResource):
            observed = resources_rpc.resource_type_versioned_topic(obj_name)
        self.assertEqual(expected, observed)

class ResourcesPullRpcApiTestCase(ResourcesRpcBaseTestCase):

    def setUp(self):
        super(ResourcesPullRpcApiTestCase, self).setUp()
        self.rpc = resources_rpc.ResourcesPullRpcApi()
        mock.patch.object(self.rpc, 'client').start()
        self.cctxt_mock = self.rpc.client.prepare.return_value

    def test_is_singleton(self):
        self.assertIs(self.rpc, resources_rpc.ResourcesPullRpcApi())

    def test_pull(self):
        self.obj_registry.register(FakeResource)
        expected_obj = _create_test_resource(self.context)
        resource_id = expected_obj.id
        self.cctxt_mock.call.return_value = expected_obj.obj_to_primitive()

        result = self.rpc.pull(
            self.context, FakeResource.obj_name(), resource_id)

        self.cctxt_mock.call.assert_called_once_with(
            self.context, 'pull', resource_type='FakeResource',
            version=TEST_VERSION, resource_id=resource_id)
        self.assertEqual(expected_obj, result)

    def test_pull_resource_not_found(self):
        resource_dict = _create_test_dict()
        resource_id = resource_dict['id']
        self.cctxt_mock.call.return_value = None
        with testtools.ExpectedException(resources_rpc.ResourceNotFound):
            self.rpc.pull(self.context, FakeResource.obj_name(),
                          resource_id)

class ResourcesPushToServerRpcCallbackTestCase(ResourcesRpcBaseTestCase):

    def test_report_versions(self):
        callbacks = resources_rpc.ResourcesPushToServerRpcCallback()
        with mock.patch('neutron.api.rpc.callbacks.version_manager'
                        '.update_versions') as update_versions:
            version_map = {'A': '1.0'}
            callbacks.report_agent_resource_versions(context=mock.ANY,
                                      agent_type='DHCP Agent',
                                      agent_host='fake-host',
                                      version_map=version_map)
            update_versions.assert_called_once_with(mock.ANY,
                                                    version_map)

class ResourcesPullRpcCallbackTestCase(ResourcesRpcBaseTestCase):

    def setUp(self):
        super(ResourcesPullRpcCallbackTestCase, self).setUp()
        self.obj_registry.register(FakeResource)
        self.callbacks = resources_rpc.ResourcesPullRpcCallback()
        self.resource_obj = _create_test_resource(self.context)

    def test_pull(self):
        resource_dict = _create_test_dict(uuid=self.resource_obj.id)
        with mock.patch.object(
                resources_rpc.prod_registry, 'pull',
                return_value=self.resource_obj) as registry_mock:
            primitive = self.callbacks.pull(
                self.context, resource_type=FakeResource.obj_name(),
                version=TEST_VERSION,
                resource_id=self.resource_obj.id)
        registry_mock.assert_called_once_with(
            'FakeResource', self.resource_obj.id, context=self.context)
        self.assertEqual(resource_dict,
                         primitive['versioned_object.data'])
        self.assertEqual(self.resource_obj.obj_to_primitive(), primitive)

    @mock.patch.object(FakeResource, 'obj_to_primitive')
    def test_pull_backports_to_older_version(self, to_prim_mock):
        with mock.patch.object(resources_rpc.prod_registry, 'pull',
                               return_value=self.resource_obj):
            self.callbacks.pull(
                self.context, resource_type=FakeResource.obj_name(),
                version='0.9',  # less than initial version 1.0
                resource_id=self.resource_obj.id)
            to_prim_mock.assert_called_with(target_version='0.9')

class ResourcesPushRpcApiTestCase(ResourcesRpcBaseTestCase):
    """Tests the neutron server side of the RPC interface."""

    def setUp(self):
        super(ResourcesPushRpcApiTestCase, self).setUp()
        mock.patch.object(resources_rpc.n_rpc, 'get_client').start()
        self.rpc = resources_rpc.ResourcesPushRpcApi()
        self.cctxt_mock = self.rpc.client.prepare.return_value
        mock.patch.object(version_manager, 'get_resource_versions',
                         return_value=set([TEST_VERSION])).start()

    def test__prepare_object_fanout_context(self):
        expected_topic = topics.RESOURCE_TOPIC_PATTERN % {
            'resource_type': resources.get_resource_type(
                self.resource_objs[0]),
            'version': TEST_VERSION}

        observed = self.rpc._prepare_object_fanout_context(
            self.resource_objs[0], self.resource_objs[0].VERSION, '1.0')

        self.rpc.client.prepare.assert_called_once_with(
            fanout=True, topic=expected_topic, version='1.0')
        self.assertEqual(self.cctxt_mock, observed)

    def test_push_single_type(self):
        self.rpc.push(
            self.context, self.resource_objs, TEST_EVENT)

        self.cctxt_mock.cast.assert_called_once_with(
            self.context, 'push',
            resource_list=[resource.obj_to_primitive()
                           for resource in self.resource_objs],
            event_type=TEST_EVENT)

    def test_push_mixed(self):
        self.rpc.push(
            self.context, self.resource_objs + self.resource_objs2,
            event_type=TEST_EVENT)

        self.cctxt_mock.cast.assert_any_call(
            self.context, 'push',
            resource_list=[resource.obj_to_primitive()
                           for resource in self.resource_objs],
            event_type=TEST_EVENT)

        self.cctxt_mock.cast.assert_any_call(
            self.context, 'push',
            resource_list=[resource.obj_to_primitive()
                           for resource in self.resource_objs2],
            event_type=TEST_EVENT)

    def test_push_mitaka_backwardscompat(self):
        #TODO(mangelajo) remove in Ocata, since the 'resource' parameter
        #                is just for backwards compatibility with Mitaka
        #                agents.
        self.rpc.push(
            self.context, [self.resource_objs[0]], TEST_EVENT)

        self.cctxt_mock.cast.assert_called_once_with(
            self.context, 'push',
            resource=self.resource_objs[0].obj_to_primitive(),
            event_type=TEST_EVENT)

class ResourcesPushRpcCallbackTestCase(ResourcesRpcBaseTestCase):
    """Tests the agent-side of the RPC interface."""

    def setUp(self):
        super(ResourcesPushRpcCallbackTestCase, self).setUp()
        self.callbacks = resources_rpc.ResourcesPushRpcCallback()

    @mock.patch.object(resources_rpc.cons_registry, 'push')
    def test_push(self, reg_push_mock):
        self.obj_registry.register(FakeResource)
        self.callbacks.push(self.context,
                            resource_list=[resource.obj_to_primitive()
                                           for resource in self.resource_objs],
                            event_type=TEST_EVENT)
        reg_push_mock.assert_called_once_with(self.resource_objs[0].obj_name(),
                                              self.resource_objs,
                                              TEST_EVENT)

    @mock.patch.object(resources_rpc.cons_registry, 'push')
    def test_push_mitaka_backwardscompat(self, reg_push_mock):
        #TODO(mangelajo) remove in Ocata, since the 'resource' parameter
        #                is just for backwards compatibility with Mitaka
        #                agents.
        self.obj_registry.register(FakeResource)
        self.callbacks.push(self.context,
                            resource=self.resource_objs[0].obj_to_primitive(),
                            event_type=TEST_EVENT)
        reg_push_mock.assert_called_once_with(self.resource_objs[0].obj_name(),
                                              [self.resource_objs[0]],
                                              TEST_EVENT)


text:
from django.utils.translation import ugettext_lazy as _
from openstack_dashboard.dashboards.admin import dashboard
from openstack_dashboard import api
import logging
import horizon
LOG = logging.getLogger(__name__)

class VGPUInstances(horizon.Panel):
    name = _("VGPUInstances")
    slug = 'vgpu'

    def nav(self, context):
        hyper = api.nova.hypervisor_list(context['request'])
        LOG.info("hyper =========================%s" % hyper)
        hyper_type =[h for h in hyper if h.hypervisor_type != "QEMU"]
        if hyper_type:
            return True
        return False


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_main"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="org.kikermo.blepotcontroller.activity.MainActivity">

    <SeekBar
        android:id="@+id/pot"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_alignParentStart="true"
        android:layout_centerVertical="true"
        android:max="100"
        android:progress="0" />

    <TextView
        android:id="@+id/value"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/pot"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="24dp"
        android:text="0%"
        android:textSize="@dimen/text_size_big" />

</RelativeLayout>


text:
package ch.bfh.swos.bookapp.cqrs.book.application.handler;

import ch.bfh.swos.bookapp.cqrs.book.application.command.AddBookCommand;
import ch.bfh.swos.bookapp.cqrs.book.application.command.ChangeBookTitleCommand;
import ch.bfh.swos.bookapp.cqrs.book.application.command.RemoveBookCommand;
import ch.bfh.swos.bookapp.cqrs.book.domain.Book;
import org.axonframework.commandhandling.annotation.CommandHandler;
import org.axonframework.repository.Repository;
import org.springframework.stereotype.Component;

import javax.inject.Inject;
import javax.inject.Named;

/**
 * Created with IntelliJ IDEA.
 * User: rovi
 * Date: 13.08.13
 * Time: 13:29
 * To change this template use File | Settings | File Templates.
 */
@Component
public class BookCommandHandler {

    @Inject
    @Named("eventBookRepository")
    private Repository<Book> repository;

    public BookCommandHandler() {
    }

    public BookCommandHandler(Repository<Book> repository) {
        this.repository = repository;
    }

    @CommandHandler
    public void on(AddBookCommand command) {
        System.out.println("Axon received AddBookCommand");
        Book book = new Book(command.getBookId(), command.getTitle(), command.getReleaseDate(), command.getAuthorId());
        repository.add(book);
    }

    @CommandHandler
    public void on(ChangeBookTitleCommand command) {
        System.out.println("Axon received ChangeBookTitleCommand");
        Book book = repository.load(command.getBookId());
        book.changeTitle(command.getNewTitle());
    }

    @CommandHandler
    public void on(RemoveBookCommand command) {
        System.out.println("Axon received RemoveBookCommand");
        Book book = repository.load(command.getBookId());
        book.remove();
    }
}


text:
package com.codiply.barrio.tests.helpers

import org.scalamock.scalatest.MockFactory
import org.scalatest.FlatSpec

import com.codiply.barrio.geometry.Point.Coordinates
import com.codiply.barrio.helpers.PointLoader

class PointLoaderSpec extends FlatSpec with MockFactory {
  val separator = "@"
  val coordinateSeparator = ","

  val coordinatesParserNotToBeCalled = (input: String) => {
    assert(false, s"the coordinates parser was used")
    Some(Coordinates())
  }

  "PointLoader.createCoordinatesParser returns a parser that" should
    "return None for an empty string" in {
    val dimensions = 2
    val input = ""
    val parse = PointLoader.createCoordinatesParser(dimensions, coordinateSeparator)
    assert(parse(input) == None)
  }
  it should "return None if less dimensions present" in {
    val dimensions = 2
    val input = "1.0"
    val parse = PointLoader.createCoordinatesParser(dimensions, coordinateSeparator)
    assert(parse(input) == None)
  }
  it should "return None if more dimensions present" in {
    val dimensions = 2
    val input = "1.0, 2.0, 3.0"
    val parse = PointLoader.createCoordinatesParser(dimensions, coordinateSeparator)
    assert(parse(input) == None)
  }
  it should "return the expected result if the right number of dimensions is present" in {
    val dimensions = 2
    val input = "1.0, 2.0"
    val parse = PointLoader.createCoordinatesParser(dimensions, coordinateSeparator)
    val expected = Some(Coordinates(1.0, 2.0))
    assert(parse(input) == expected)
  }

  "PointLoader.createCsvLineParser returns a parser that" should
    "return None for an empty string" in {
    val input = ""

    val parse = PointLoader.createCsvLineParser(separator, coordinatesParserNotToBeCalled)
    assert(parse(input) == None)
  }
  it should "return None for input with a single part" in {
    val input = "some-id"

    val parse = PointLoader.createCsvLineParser(separator, coordinatesParserNotToBeCalled)
    assert(parse(input) == None)
  }
  it should "return None for input with more than 3 parts" in {
    val input = (1 to 4).mkString(separator)

    val parse = PointLoader.createCsvLineParser(separator, coordinatesParserNotToBeCalled)
    assert(parse(input) == None)
  }
  it should "return the expected results for input with id and coordinates" in {
    val id = "some-id"
    val coordinates = Coordinates(1.0,2.0,3.0)
    val coordinatesString = coordinates.mkString(coordinateSeparator)
    val input = s"$id$separator$coordinatesString"

    val mockCoordinatesParser = mockFunction[String, Option[Coordinates]]
    mockCoordinatesParser.expects(coordinatesString).returning(Some(coordinates)).once()

    val parse = PointLoader.createCsvLineParser(separator, mockCoordinatesParser)
    val output = parse(input)

    assert(output.isDefined)
    assert(output.get.id == id)
    assert(output.get.location == coordinates)
    assert(output.get.data == "")
  }
  it should "return the expected results for input with id, coordinates and additional data" in {
    val id = "some-id"
    val coordinates = Coordinates(1.0,2.0,3.0)
    val coordinatesString = coordinates.mkString(coordinateSeparator)
    val data = "some-data"
    val input = s"$id$separator$coordinatesString$separator$data"

    val mockCoordinatesParser = mockFunction[String, Option[Coordinates]]
    mockCoordinatesParser.expects(coordinatesString).returning(Some(coordinates)).once()

    val parse = PointLoader.createCsvLineParser(separator, mockCoordinatesParser)
    val output = parse(input)

    assert(output.isDefined)
    assert(output.get.id == id)
    assert(output.get.location == coordinates)
    assert(output.get.data == data)
  }
  it should "trim whitespace before parsing" in {
    val id = "some-id"
    val coordinates = Coordinates(1.0,2.0,3.0)
    val coordinatesString = coordinates.mkString(coordinateSeparator)
    val data = "some-data"
    val input = s"  $id   $separator $coordinatesString$separator $data  "

    val mockCoordinatesParser = mockFunction[String, Option[Coordinates]]
    mockCoordinatesParser.expects(coordinatesString).returning(Some(coordinates)).once()

    val parse = PointLoader.createCsvLineParser(separator, mockCoordinatesParser)
    val output = parse(input)

    assert(output.isDefined)
    assert(output.get.id == id)
    assert(output.get.location == coordinates)
    assert(output.get.data == data)
  }
}


text:
package modularmachines.api.modules;

import javax.annotation.Nullable;

import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;

import net.minecraftforge.common.capabilities.ICapabilityProvider;

import modularmachines.api.components.IComponentProvider;
import modularmachines.api.modules.components.IModuleComponent;
import modularmachines.api.modules.container.IModuleContainer;
import modularmachines.api.modules.positions.IModulePosition;

/**
 * It contains the components, the position and module handler of the module.
 */
public interface IModule extends INBTWritable, IComponentProvider<IModuleComponent>, ICapabilityProvider {

	/**
	 * @return The module handler that contains and handles this module.
	 */
	IModuleHandler getHandler();

	/**
	 * @return The module container that contains every module.
	 */
	IModuleContainer getContainer();

	/**
	 * @return The provider that provides this module.
	 */
	IModuleProvider getProvider();

	/**
	 * @return The position of this module at the parent.
	 */
	IModulePosition getPosition();

	/**
	 * @return The item that was used to create this module.
	 */
	ItemStack getItemStack();

	/**
	 * @return Creates a item that drops if the module was extracted or the block that contains the module container was
	 * destroyed by a player.
	 */
	ItemStack createItem();

	/**
	 * @return The internal index of this module. It is generated out of the position of the module and the positions
	 * of the parents.
	 */
	int getIndex();

	/**
	 * @return The module data that was used to create this module.
	 */
	IModuleData getData();

	/* FACING */

	/**
	 * @return The facing of this module.
	 */
	EnumFacing getFacing();

	/**
	 * @return The given side relative to the facing of this module.
	 */
	EnumFacing getSide(EnumFacing side);

	/**
	 * Returns true if the given side is the facing of the module.
	 */
	boolean isFacing(@Nullable EnumFacing side);

	/**
	 * Sends the data of all {@link modularmachines.api.components.INetworkComponent}s of this module to the client.
	 */
	void sendToClient();

	/**
	 * @return If the module is empty and contains the default {@link IModuleData}.
	 */
	boolean isEmpty();
}


text:
namespace state {
    export let codexWebRootPrefix = "";
    export let defaultWindowTitle = "Index";
    export let WebPage: CodexWebPage;
    export let codexEditor: CodexEditor;
    export let ctrlClickLinkDecorations: string[];

    export let currentState: CodexWebState;
    export let initialState: CodexWebState;
    export let searchBox: any;
    export let lastSearchString: any;
    export let selectedFile;
    export let rightPaneIsEditor: boolean;

    export let lastQuery: string = null;
    export let searchTimerID: number = -1;

    export let keyboardSelectedResultGroup : any = null;
    export let keyboardSelectedResult : any = null;
    export let keyboardSelectedUIElement : any = null;
}

type RightPaneContent = 'file' | 'line' | 'symbol' | 'overview' | 'about';
type LeftPaneContent = 'outline' | 'search' | 'project' | 'references' | 'namespaces';

interface CodexWebState {
    leftProjectId: string;
    rightProjectId: string;
    filePath: string;
    leftSymbolId: string;
    projectScope: string;
    rightSymbolId: string;
    lineNumber: number;
    searchText: string;
    windowTitle: string;
    leftPaneContent: LeftPaneContent;
    rightPaneContent: RightPaneContent;
}

function renderState(webState: CodexWebState) {

    let right: RightPaneViewModel = undefined;
    switch (webState.rightPaneContent || 'overview') {
        case 'file':
        case 'line':
        case 'symbol':
            let targetLocation: TargetEditorLocation;
            switch (webState.rightPaneContent) {
                case 'file':
                    // Do nothing. Just navigate to file
                    break;
                case 'line':
                    targetLocation = { kind: 'line', value: webState.lineNumber };
                    break;
                case 'symbol':
                    targetLocation = {
                        kind: 'symbol', value: { projectId: webState.rightProjectId, symbolId: webState.rightSymbolId }
                    };
                    break;
            }

            right = <FileViewModel>{
                kind: 'SourceFile',
                targetLocation: targetLocation,
                filePath: webState.filePath,
                projectId: webState.rightProjectId,
            };
            break;
        case 'overview':
            right = new OverviewViewModel();
            break;
    }

    let webPage = state.WebPage;
    webPage.setViewModel({ right: right, left: undefined });
}

function codexInit(initialState: CodexWebState) {
    state.WebPage = new CodexWebPage();
    state.initialState = initialState;
}

function codexWebMain(initialState: CodexWebState) {
    ensureSearchBox();

    renderState(initialState);
    // DisplayState(initialState);
    //ReplaceCurrentState();
}

function onBodyLoad() {
    var anchor = document.location.hash;
    if (anchor && !document.location.search && document.location.pathname === "/") {
        top.location.replace("http://ddindex/" + anchor);
        return;
    }

    // https://github.com/nathancahill/Split.js
    Split(['#leftPane', '#rightPane'], {
        sizes: ['504px', 'calc(100% - 504px)'],
        gutterSize: 20,
        minSize: 1,
        cursor: 'col-resize'
    });

    ensureSearchBox();

    // TODO: why href is missing?
    var link = <any>document.getElementById("feedbackButtonLink");
    link.href = "mailto:" + "codexteam" + "@" + "microsoft" + '.' + "com";

    window.onpopstate = OnWindowPopState;
    codexWebMain(state.initialState);
}


text:
'use strict';

describe('Controller: ImportResultsCtrl', function () {
// load the controller's module
  beforeEach(module('we99App'));

  var ImportResultsCtrl,
    scope, fakeModal, fakeUpload;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope,$log) {
    scope = $rootScope.$new();

    fakeUpload = {
      upload: function (config) {
        this.savedConfig = config;
        // return fake promises for progress, success, error
        return {
          progress: function (f) {
            var evt={loaded: 1, total:1,config:{file:{name:'myfile'}}};
            f(evt);
            return {
              success: function (f) {
                f('good');
                return {
                  error: function (f) {
                    f('error case');
                  }
                }
              }
            }
          }
        };
      }
    };

    fakeModal = {
      result: {
        then: function(confirmCallback, cancelCallback) {
          //Store the callbacks for later when the user clicks on the OK or Cancel button of the dialog
          this.confirmCallBack = confirmCallback;
          this.cancelCallback = cancelCallback;
        }
      },
      close: function( item ) {

        this.confirmed=true;
        //The user clicked OK on the modal dialog, call the stored confirm callback with the selected item
        if(this.result.confirmCallBack)
          this.result.confirmCallBack( item );
      },
      dismiss: function( type ) {
        this.canceled=true;
        //The user clicked cancel on the modal dialog, call the stored cancel callback
        if(this.result.cancelCallback)
          this.result.cancelCallback( type );
      },
      canceled: false,
      confirmed: false
    };

    ImportResultsCtrl = $controller('ImportResultsCtrl', {
      $scope: scope,
      $upload: fakeUpload,
      $log: $log,
      $modalInstance: fakeModal,
      experiment: {id:1},
      plate: {id:1}
    });
  }));

  it('should start with a defined scope.experiment and success = false ', function () {
    expect(scope.experiment).toBeDefined();
    expect(scope.experiment).not.toBeNull();
    expect(scope.success).toBe(false);
  });

  it('should call upload service when files are added', function () {
    scope.files=['newfile'];
    scope.upload();

    expect(fakeUpload.savedConfig).toBeDefined();
    expect(fakeUpload.savedConfig).not.toBeNull();

    expect(fakeUpload.savedConfig.method).toBe("POST");
    expect(fakeUpload.savedConfig.file).toBe("newfile");
    expect(fakeUpload.savedConfig.url).toContain("services/rest");
  });

  it('should close modal instance with confirmed state when success = true', function () {

    expect(fakeModal.confirmed).toBe(false);

    scope.success=true;
    scope.dismiss();

    expect(fakeModal.confirmed).toBe(true);

  });

  it('set alert to null when closeAlert() is hit', function () {
    scope.modalResponseMsg="too hot!";
    scope.closeAlert();
    expect(scope.modalResponseMsg).toBeNull();
  });
});


text:
package ratelimiter

import (
	"time"
)

type RateLimitResult struct {
	// Limit is the maximum number of requests that could be permitted
	// instantaneously for this key starting from an empty state. For
	// example, if a rate limiter allows 10 requests per second per
	// key, Limit would always be 10.
	Limit int

	// Remaining is the maximum number of requests that could be
	// permitted instantaneously for this key given the current
	// state. For example, if a rate limiter allows 10 requests per
	// second and has already received 6 requests for this key this
	// second, Remaining would be 4.
	Remaining int

	// ResetAfter is the time until the RateLimiter returns to its
	// initial state for a given key. For example, if a rate limiter
	// manages requests per second and received one request 200ms ago,
	// Reset would return 800ms. You can also think of this as the time
	// until Limit and Remaining will be equal.
	ResetAfter time.Duration

	// RetryAfter is the time until the next request will be permitted.
	// It should be -1 unless the rate limit has been exceeded.
	RetryAfter time.Duration
}


text:
require 'minitest/autorun'
require 'rack/mock'
require 'concurrent/atomic/count_down_latch'
require File.expand_path('../testrequest', __FILE__)

Thread.abort_on_exception = true

describe Rack::Handler::WEBrick do
  include TestRequest::Helpers

  before do
  @server = WEBrick::HTTPServer.new(:Host => @host='127.0.0.1',
                                    :Port => @port=9202,
                                    :Logger => WEBrick::Log.new(nil, WEBrick::BasicLog::WARN),
                                    :AccessLog => [])
  @server.mount "/test", Rack::Handler::WEBrick,
    Rack::Lint.new(TestRequest.new)
  @thread = Thread.new { @server.start }
  trap(:INT) { @server.shutdown }
  @status_thread = Thread.new do
    seconds = 10
    wait_time = 0.1
    until is_running? || seconds <= 0
      seconds -= wait_time
      sleep wait_time
    end
    raise "Server never reached status 'Running'" unless is_running?
  end
  end

  def is_running?
    @server.status == :Running
  end

  it "respond" do
    GET("/test")
    status.must_equal 200
  end

  it "be a WEBrick" do
    GET("/test")
    status.must_equal 200
    response["SERVER_SOFTWARE"].must_match(/WEBrick/)
    response["HTTP_VERSION"].must_equal "HTTP/1.1"
    response["SERVER_PROTOCOL"].must_equal "HTTP/1.1"
    response["SERVER_PORT"].must_equal "9202"
    response["SERVER_NAME"].must_equal "127.0.0.1"
  end

  it "have rack headers" do
    GET("/test")
    response["rack.version"].must_equal [1,3]
    response["rack.multithread"].must_equal true
    assert_equal false, response["rack.multiprocess"]
    assert_equal false, response["rack.run_once"]
  end

  it "have CGI headers on GET" do
    GET("/test")
    response["REQUEST_METHOD"].must_equal "GET"
    response["SCRIPT_NAME"].must_equal "/test"
    response["REQUEST_PATH"].must_equal "/test"
    response["PATH_INFO"].must_equal ""
    response["QUERY_STRING"].must_equal ""
    response["test.postdata"].must_equal ""

    GET("/test/foo?quux=1")
    response["REQUEST_METHOD"].must_equal "GET"
    response["SCRIPT_NAME"].must_equal "/test"
    response["REQUEST_PATH"].must_equal "/test/foo"
    response["PATH_INFO"].must_equal "/foo"
    response["QUERY_STRING"].must_equal "quux=1"

    GET("/test/foo%25encoding?quux=1")
    response["REQUEST_METHOD"].must_equal "GET"
    response["SCRIPT_NAME"].must_equal "/test"
    response["REQUEST_PATH"].must_equal "/test/foo%25encoding"
    response["PATH_INFO"].must_equal "/foo%25encoding"
    response["QUERY_STRING"].must_equal "quux=1"
  end

  it "have CGI headers on POST" do
    POST("/test", {"rack-form-data" => "23"}, {'X-test-header' => '42'})
    status.must_equal 200
    response["REQUEST_METHOD"].must_equal "POST"
    response["SCRIPT_NAME"].must_equal "/test"
    response["REQUEST_PATH"].must_equal "/test"
    response["PATH_INFO"].must_equal ""
    response["QUERY_STRING"].must_equal ""
    response["HTTP_X_TEST_HEADER"].must_equal "42"
    response["test.postdata"].must_equal "rack-form-data=23"
  end

  it "support HTTP auth" do
    GET("/test", {:user => "ruth", :passwd => "secret"})
    response["HTTP_AUTHORIZATION"].must_equal "Basic cnV0aDpzZWNyZXQ="
  end

  it "set status" do
    GET("/test?secret")
    status.must_equal 403
    response["rack.url_scheme"].must_equal "http"
  end

  it "correctly set cookies" do
    @server.mount "/cookie-test", Rack::Handler::WEBrick,
    Rack::Lint.new(lambda { |req|
                     res = Rack::Response.new
                     res.set_cookie "one", "1"
                     res.set_cookie "two", "2"
                     res.finish
                   })

    Net::HTTP.start(@host, @port) { |http|
      res = http.get("/cookie-test")
      res.code.to_i.must_equal 200
      res.get_fields("set-cookie").must_equal ["one=1", "two=2"]
    }
  end

  it "provide a .run" do
    block_ran = false
    latch = Concurrent::CountDownLatch.new 1

    t = Thread.new do
      Rack::Handler::WEBrick.run(lambda {},
                                 {
                                   :Host => '127.0.0.1',
                                   :Port => 9210,
                                   :Logger => WEBrick::Log.new(nil, WEBrick::BasicLog::WARN),
                                   :AccessLog => []}) { |server|
        block_ran = true
        assert_kind_of WEBrick::HTTPServer, server
        @s = server
        latch.count_down
      }
    end

    latch.wait
    @s.shutdown
    t.join
  end

  it "return repeated headers" do
    @server.mount "/headers", Rack::Handler::WEBrick,
    Rack::Lint.new(lambda { |req|
        [
          401,
          { "Content-Type" => "text/plain",
            "WWW-Authenticate" => "Bar realm=X\nBaz realm=Y" },
          [""]
        ]
      })

    Net::HTTP.start(@host, @port) { |http|
      res = http.get("/headers")
      res.code.to_i.must_equal 401
      res["www-authenticate"].must_equal "Bar realm=X, Baz realm=Y"
    }
  end

  it "support Rack partial hijack" do
    io_lambda = lambda{ |io|
      5.times do
        io.write "David\r\n"
      end
      io.close
    }

    @server.mount "/partial", Rack::Handler::WEBrick,
    Rack::Lint.new(lambda{ |req|
      [
        200,
        {"rack.hijack" => io_lambda},
        [""]
      ]
    })

    Net::HTTP.start(@host, @port){ |http|
      res = http.get("/partial")
      res.body.must_equal "David\r\nDavid\r\nDavid\r\nDavid\r\nDavid\r\n"
    }
  end

  it "produce correct HTTP semantics with and without app chunking" do
    @server.mount "/chunked", Rack::Handler::WEBrick,
    Rack::Lint.new(lambda{ |req|
      [
        200,
        {"Transfer-Encoding" => "chunked"},
        ["7\r\nchunked\r\n0\r\n\r\n"]
      ]
    })

    Net::HTTP.start(@host, @port){ |http|
      res = http.get("/chunked")
      res["Transfer-Encoding"].must_equal "chunked"
      res["Content-Length"].must_equal nil
      res.body.must_equal "chunked"
    }
  end

  after do
  @status_thread.join
  @server.shutdown
  @thread.join
  end
end


text:
This module provides a simplistic Mesos simulation which can be used for Marathon scale tests.

# Run Marathon in Simulation Mode

The marathon with the simulated Mesos can be started from the command line like this:

```bash
sbt -Djava.library.path=<...include the directories of your native mesos libraries...> \
    "project mesos-simulation" "run --master zk://localhost:2181/mesos --zk zk://localhost:2181/marathon"
```

Of course, you can adjust your configuration. You need to provide the master configuration but no Mesos master or slave
has to be running.

# Run Automated Scaling Test

Run scaling tests:

```bash
sbt "project mesos-simulation" "integration:testOnly **ScalingTest"
```

Show results:

```bash
sbt "project mesos-simulation" "test:run-main mesosphere.mesos.scale.DisplayAppScalingResults"
```

The simulation is currently not configurable outside the code. If you want to adjust the number
of offers sent every offer cycle, you can change `mesosphere.mesos.simulation.DriverActor.numberOfOffersPerCycle`.


text:
var searchData=
[
  ['tableview',['tableView',['../interface_date_picker_view_controller.html#a982400761463df927eb7af866537ece0',1,'DatePickerViewController']]],
  ['text',['text',['../interface_checklist_item.html#aaa5b49b407e8e4d0fbd323eddef5b303',1,'ChecklistItem']]],
  ['textfield',['textField',['../interface_category_detail_view_controller.html#ad6a7d0592784bdfe80188a3f14a18163',1,'CategoryDetailViewController::textField()'],['../interface_item_detail_view_controller.html#a178790ef36e700ef0735d92a3fdd5777',1,'ItemDetailViewController::textField()']]],
  ['togglechecked',['toggleChecked',['../interface_checklist_item.html#ac458392102cff14f30fd2e920bf328fe',1,'ChecklistItem']]]
];


text:
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jira.SDK.Domain
{
    public class ProjectType
    {
        [JsonIgnore()]
        public Jira Jira { get; set; }

        [JsonProperty(propertyName: "key")]
        public string Key { get; set; }
        [JsonProperty(propertyName: "formattedkey")]
        public string FormattedKey { get; set; }
        [JsonProperty(propertyName: "color")]
        public string Color { get; set; }
        [JsonProperty(propertyName: "description|i18nKey")]
        public string Description { get; set; }
        [JsonProperty(propertyName: "icon")]
        public string icon { get; set; }
    }
}


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"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

	<bean id="defaultStrategySubjectLocator" class="org.esco.grouperui.services.grouper.internal.locator.DefaultStrategySubjectLocator">
		<property name="evaluator" ref="evaluator" />
		<property name="defaultSearchStrategies" >
			<map>
				<entry key="evaluator.regexp('(esco:Etablissements:(([^_]+)_(\\d{5,7}\\w?))(:[^:]+)*)|(esco:admin:.+)|(esco:Applications:.+)', path)" value-ref="UAIStrategySubjectSearch"></entry>
                <entry key="evaluator.regexp('(.*)', term)" value-ref="defaulStrategySubjectSearch"></entry>
			</map>
		</property>
	</bean>

	<bean id="defaulStrategySubjectSearch" class="org.esco.grouperui.services.grouper.internal.DefaultStrategySubjectSearch" >
		<property name="personWrapper" ref="personWrapper" />
	</bean>

	<bean id="UAIStrategySubjectSearch" class="org.esco.grouperui.services.grouper.internal.UAIStrategySubjectSearch" >
		<property name="personWrapper" ref="personWrapper" />
	</bean>

	<bean id="evaluator" class="org.esco.grouperui.services.grouper.internal.expressions.ExpressionEvaluator" />

	<bean id="personWrapper" class="org.esco.grouperui.services.grouper.internal.wrapper.PersonWrapper" />

</beans>


text:
export default function EventsResource({apiHandler}) {
    return {
        async getAll({limit = null, offset = null} = {}) {
            const params = {
                limit,
                offset
            };
            return await apiHandler.getAll(`events`, params);
        },

        async get({eventType}) {
            return await apiHandler.get(`events/${eventType}`);
        },

        async getRules({eventType}) {
            return await apiHandler.get(`events/${eventType}/rules`);
        },

        async createRules({eventType, data}) {
            return await apiHandler.put(`events/${eventType}/rules`, data);
        },

        async updateRules({eventType, data}) {
            return await apiHandler.put(`events/${eventType}/rules`, data);
        },

        async getRulesHistory({eventType, limit = null, offset = null} = {}) {
            const params = {
                limit,
                offset
            };
            return await apiHandler.getAll(`events/${eventType}/rules/history`, params);
        },

        async getRulesVersionNumber({eventType, version}) {
            return await apiHandler.get(`events/${eventType}/rules/history/${version}`);
        },

        async getRulesVersionDetail({eventType, version}) {
            return await apiHandler.get(`events/${eventType}/rules/versions/${version}`);
        }
    };
};


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="pl.lizardproject.qe2017">

    <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".login.LoginActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity android:name=".itemlist.ItemListActivity"/>
        <activity android:name=".register.RegisterActivity"/>
        <activity
            android:name=".edititem.EditItemActivity"
            android:windowSoftInputMode="adjustResize"/>
    </application>
</manifest>


text:
package com.googlecode.lanterna.gui2;

import com.googlecode.lanterna.graphics.BasicTextImage;
import com.googlecode.lanterna.graphics.TextImage;
import com.googlecode.lanterna.input.*;
import com.googlecode.lanterna.screen.Screen;
import com.googlecode.lanterna.*;
import com.googlecode.lanterna.screen.VirtualScreen;
import com.googlecode.lanterna.gui2.Window.Hint;

import java.io.EOFException;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean
;

/**
 *
 * @author ginkoblongata
 */
public class WindowList {

    private final List<Window> windows = new LinkedList<Window>();
    private final List<Window> stableOrderingOfWindows = new ArrayList<Window>();

    private Window activeWindow = null;
    private boolean hadWindowAtSomePoint = false;

    public List<Window> getWindowsInZOrder() {
        return Collections.unmodifiableList(windows);
    }

    public List<Window> getWindowsInStableOrder() {
        return Collections.unmodifiableList(stableOrderingOfWindows);
    }

    public void setActiveWindow(Window activeWindow) {
        this.activeWindow = activeWindow;
        if (activeWindow != null) {
            moveToTop(activeWindow);
        }
    }

    public Window getActiveWindow() {
        return activeWindow;
    }

    public void addWindow(Window window) {
        if (!stableOrderingOfWindows.contains(window)) {
            stableOrderingOfWindows.add(window);
        }
        if(!windows.contains(window)) {
            windows.add(window);
        }
        if(!window.getHints().contains(Window.Hint.NO_FOCUS)) {
            setActiveWindow(window);
        }
        hadWindowAtSomePoint = true;
    }

    /**
     * Removes the window from this WindowList.
     * @return true if this WindowList contained the specified Window
     */
    public boolean removeWindow(Window window) {
        boolean contained = windows.remove(window);
        stableOrderingOfWindows.remove(window);

        if(activeWindow == window) {
            // in case no suitable window is found, so pass control back to the background pane
            setActiveWindow(null);

            //Go backward in reverse and find the first suitable window
            for(int index = windows.size() - 1; index >= 0; index--) {
                Window candidate = windows.get(index);
                if(!candidate.getHints().contains(Window.Hint.NO_FOCUS)) {
                    setActiveWindow(candidate);
                    break;
                }
            }
        }

        return contained;
    }

    public boolean isHadWindowAtSomePoint() {
        return hadWindowAtSomePoint;
    }

    public void moveToTop(Window window) {
        if(!windows.contains(window)) {
            throw new IllegalArgumentException("Window " + window + " isn't in MultiWindowTextGUI " + this);
        }
        windows.remove(window);
        windows.add(window);
    }

    public void moveToBottom(Window window) {
        if(!windows.contains(window)) {
            throw new IllegalArgumentException("Window " + window + " isn't in MultiWindowTextGUI " + this);
        }
        windows.remove(window);
        windows.add(0, window);
    }
    /**
     * Switches the active window by cyclically shuffling the window list. If {@code reverse} parameter is {@code false}
     * then the current top window is placed at the bottom of the stack and the window immediately behind it is the new
     * top. If {@code reverse} is set to {@code true} then the window at the bottom of the stack is moved up to the
     * front and the previous top window will be immediately below it
     * @param reverse Direction to cycle through the windows
     * @return Itself
     */
    public void cycleActiveWindow(boolean reverse) {
        if(windows.isEmpty() || windows.size() == 1 || (activeWindow != null && activeWindow.getHints().contains(Window.Hint.MODAL))) {
            return;
        }
        Window originalActiveWindow = activeWindow;
        Window nextWindow;
        if(activeWindow == null) {
            // Cycling out of active background pane
            nextWindow = reverse ? windows.get(windows.size() - 1) : windows.get(0);
        } else {
            // Switch to the next window
            nextWindow = getNextWindow(reverse, activeWindow);
        }

        int noFocusWindows = 0;
        while(nextWindow.getHints().contains(Window.Hint.NO_FOCUS)) {
            ++noFocusWindows;
            if(noFocusWindows == windows.size()) {
                // All windows are NO_FOCUS, so give up
                return;
            }
            nextWindow = getNextWindow(reverse, nextWindow);
            if(nextWindow == originalActiveWindow) {
                return;
            }
        }

        if(reverse) {
            moveToTop(nextWindow);
        } else if (originalActiveWindow != null) {
            moveToBottom(originalActiveWindow);
        }
        setActiveWindow(nextWindow);
    }

    private Window getNextWindow(boolean reverse, Window window) {
        int index = windows.indexOf(window);
        if(reverse) {
            if(++index >= windows.size()) {
                index = 0;
            }
        } else {
            if(--index < 0) {
                index = windows.size() - 1;
            }
        }
        return windows.get(index);
    }
}


text:
Erik-Jan van Kesteren

###[Back to index](../index.html)

## Introduction
This blog will introduce the basics of blogging using R Markdown, using this webpage as an example. It's a tutorial in which we will work through the following:

1. Why would I want to blog with R Markdown?
2. How to create the blog
    + Getting started
    + How to structure your files
    + How to create a blogpost
3. How to host the webpage for free!
    + Version control
    + GitHub pages
    + Custom URL

Let's get started!

## Why???
[R Markdown](http://rmarkdown.rstudio.com/) is an Rstudio project built for writing reproducible notebooks that integrate `R` (and possibly other) code and output. The main idea is to make this as simple as possible. This is why it was built on [Markdown](http://daringfireball.net/projects/markdown/), the widely used, easy-to-read web markup language. It looks like this:

```
## Introduction
This blog will introduce the basics of blogging using R Markdown, using this webpage as an example. It's a tutorial in which we will work through the following:

1. Why would I want to blog with R Markdown?
2. How to create the blog
    + Getting started
    + How to structure your files
    + How to create a blogpost
3. How to host the webpage for free!
    + Version control
    + GitHub pages
    + Custom URL

Let's get started!

## Why???
[R Markdown](http://rmarkdown.rstudio.com/) is an Rstudio project built for writing reproducible notebooks that integrate `R` (and possibly other) code and output. The main idea is to make this as simple as possible. This is why it was built on [Markdown](http://daringfireball.net/projects/markdown/), the widely available, easy-to-read web markup language. It looks like this:
```

As you can see, it is easy to read in plaintext form, it's simple to make lists, links, headers and more. Perhaps you know it from GitHub's comment system, or StackExchange comments.

The great idea of the RStudio developers was that a markup language can be used to generate documents of many different file formats: html pages (what we will be using), articles, word documents, etc.

So why would you want to use it for blogging? Here are my reasons:

1. _I love_ `R`. May sound strange, but I feel really at home in the RStudio IDE and programming with `R` has become ...
2. MathJax support. Just look at this $e^{i\pi} + 1 = 0$. Beautiful if you want to write formulas.
3. I wanted to write _about_ `R` programming. Extensive
4. Everything in one place.

###[Back to index](../index.html)


text:
class Datum < ApplicationRecord

  has_one :article

end


text:
package nokogiri.internals;

import static nokogiri.internals.NokogiriHelpers.getNokogiriClass;

import java.util.ArrayList;
import java.util.List;

import nokogiri.NokogiriService;
import nokogiri.XmlSyntaxError;

import org.apache.xerces.xni.parser.XMLErrorHandler;
import org.jruby.Ruby;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.xml.sax.ErrorHandler;

/**
 * Super class of error handlers.
 *
 * XMLErrorHandler is used by nokogiri.internals.HtmlDomParserContext since NekoHtml
 * uses this type of the error handler.
 *
 * @author sergio
 * @author Yoko Harada <yokolet@gmail.com>
 */
public abstract class NokogiriErrorHandler implements ErrorHandler, XMLErrorHandler {
    protected List<Exception> errors;
    protected boolean noerror;
    protected boolean nowarning;

    public NokogiriErrorHandler(boolean noerror, boolean nowarning) {
        errors = new ArrayList<Exception>();
        this.noerror = noerror;
        this.nowarning = nowarning;
    }

    public List<Exception> getErrors() { return errors; }

    public List<IRubyObject> getErrorsReadyForRuby(ThreadContext context) {
        Ruby runtime = context.getRuntime();
        List<IRubyObject> res = new ArrayList<IRubyObject>();
        for (int i = 0; i < errors.size(); i++) {
            XmlSyntaxError xmlSyntaxError = (XmlSyntaxError) NokogiriService.XML_SYNTAXERROR_ALLOCATOR.allocate(runtime, getNokogiriClass(runtime, "Nokogiri::XML::SyntaxError"));
            xmlSyntaxError.setException(errors.get(i));
            res.add(xmlSyntaxError);
        }
        return res;
    }

    protected boolean usesNekoHtml(String domain) {
        return "http://cyberneko.org/html".equals(domain);
    }
}


text:
Dockerfiles for WSO2
====================

Content: Dockerfiles

d-fens GmbH, General-Guisan-Strasse 6, CH-6300 Zug, Switzerland

These configuration files let you build several images for products from [WSO2](http://wso2.com) to be used with the [Docker](http://www.docker.com) framework.

You can also download these images via [Docker Hub](https://registry.hub.docker.com/u/dfch/).

See [Creating a docker image for WSO2 Complex Event Processor](http://d-fens.ch/2014/12/23/creating-a-docker-image-for-wso2-complex-event-processor/)


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Reading epochs from a raw FIF file — MNE 0.17.1 documentation</title>
    <link rel="stylesheet" href="../../_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../_static/gallery.css" />
    <link rel="stylesheet" type="text/css" href="../../_static/reset-syntax.css" />

    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />

    <link rel="stylesheet" href="../../_static/style.css " type="text/css" />
    <link rel="stylesheet" href="../../_static/font-awesome.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/flag-icon.css" type="text/css" />

  <link rel="canonical" href="https://mne.tools/stable/index.html" />

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

        0.17.1

Install

Documentation

API

Glossary

Examples

Contribute

  Site

  <button type="button" class="btn btn-primary navbar-btn dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown">
    v0.17.1

  </button>

Development

v0.17 (stable)

v0.16

v0.15

v0.14

v0.13

v0.12

v0.11

<form class="navbar-form navbar-right" action="../../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

Reading epochs from a raw FIF file

<form action="../../search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

Note

Click here to download the full example code

Reading epochs from a raw FIF file¶

This script shows how to read the epochs from a raw file given
a list of events. For illustration, we compute the evoked responses
for both MEG and EEG data by averaging all the epochs.

# Authors: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr>
#          Matti Hamalainen <msh@nmr.mgh.harvard.edu>
#
# License: BSD (3-clause)

import mne
from mne import io
from mne.datasets import sample

print(__doc__)

data_path = sample.data_path()

Set parameters

raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'
event_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw-eve.fif'
event_id, tmin, tmax = 1, -0.2, 0.5

# Setup for reading the raw data
raw = io.read_raw_fif(raw_fname)
events = mne.read_events(event_fname)

# Set up pick list: EEG + MEG - bad channels (modify to your needs)
raw.info['bads'] += ['MEG 2443', 'EEG 053']  # bads + 2 more
picks = mne.pick_types(raw.info, meg=True, eeg=False, stim=True, eog=True,
                       exclude='bads')

# Read epochs
epochs = mne.Epochs(raw, events, event_id, tmin, tmax, proj=True,
                    picks=picks, baseline=(None, 0), preload=True,
                    reject=dict(grad=4000e-13, mag=4e-12, eog=150e-6))

evoked = epochs.average()  # average epochs to get the evoked response

Out:

Opening raw data file /home/circleci/mne_data/MNE-sample-data/MEG/sample/sample_audvis_filt-0-40_raw.fif...
    Read a total of 4 projection items:
        PCA-v1 (1 x 102)  idle
        PCA-v2 (1 x 102)  idle
        PCA-v3 (1 x 102)  idle
        Average EEG reference (1 x 60)  idle
    Range : 6450 ... 48149 =     42.956 ...   320.665 secs
Ready.
Current compensation grade : 0
72 matching events found
Applying baseline correction (mode: mean)
Not setting metadata
Created an SSP operator (subspace dimension = 3)
4 projection items activated
Loading data for 72 events and 106 original time points ...
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on MAG : ['MEG 1711']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
    Rejecting  epoch based on EOG : ['EOG 061']
17 bad epochs dropped

Show result

evoked.plot(time_unit='s')

Total running time of the script: ( 0 minutes  3.166 seconds)

Estimated memory usage:  10 MB

Download Python source code: plot_read_epochs.py

Download Jupyter notebook: plot_read_epochs.ipynb

Gallery generated by Sphinx-Gallery

GitHub

·

Mailing list

·

Gitter

·

What's new

·

Cite MNE

Back to top

© Copyright 2012-2019, MNE Developers. Last updated on 2019-02-22.


text:
window.addEventListener('load', function() {

   // Get WebGL context,
   var canvas = document.getElementById("canvas");
   var context;
   try {
      context = canvas.getContext('2d');
   } catch (exception) {
      alert("Umm... sorry, no 2d contexts for you! " + exception.message);
      return ;
   }

   // Adjust the canvas size,
   canvas.width  = canvas.offsetWidth ;
   canvas.height = canvas.offsetHeight;

   // Draw the line,
   context.beginPath();
   context.moveTo(0, 0);
   context.lineTo(canvas.width, canvas.height);
   context.stroke();
});


text:
<?php

namespace Mixdinternet\Mmails;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Cviebrock\EloquentSluggable\Sluggable;
use Venturecraft\Revisionable\RevisionableTrait;

class Mmail extends Model
{
    use SoftDeletes, Sluggable, RevisionableTrait;

    protected $revisionCreationsEnabled = true;

    protected $revisionFormattedFieldNames = [
        'name' => 'nome'
        , 'to' => 'para'
        , 'toName' => 'para (nome)'
        , 'cc' => 'cópia'
        , 'bcc' => 'cópia oculta'
        , 'subject' => 'assunto'
    ];

    protected $dates = [
        'deleted_at'
    ];

    protected $fillable = [
        'status', 'name', 'to', 'toName', 'cc', 'bcc', 'subject'
    ];

    public function sluggable()
    {
        return [
            'slug' => [
                'source' => 'name'
            ]
        ];
    }

    public function scopeSort($query, $fields = [])
    {
        if (count($fields) <= 0) {
            $fields = [
                'status' => 'asc'
                , 'name' => 'asc'
            ];
        }

        if (request()->has('field') && request()->has('sort')) {
            $fields = [request()->get('field') => request()->get('sort')];
        }

        foreach ($fields as $field => $order) {
            $query->orderBy($field, $order);
        }
    }

    public function scopeActive($query)
    {
        $query->where('status', 'active')->sort();
    }

    # revision
    public function identifiableName()
    {
        return $this->name;
    }
}


text:
@interface CustomEffectConfig : NSObject<NSCoding>

@property (nonatomic) int patternIndex;
@property (nonatomic) int colorIndex;
@property (nonatomic) int lColorId;
@property (nonatomic) int rColorId;
@property (nonatomic) int leftRightValue;
@property (nonatomic) BOOL isVibrateOn;

@end