text:
var vertx = require('vertx');
var console = require('vertx/console');
var container = require('vertx/container');

var eb = vertx.eventBus;

var mongo_config = {
        "address": "mongodb-persistor",
        "host": "localhost",
        "port": 27017,
        "pool_size": 10,
        "db_name": "vertx"
}

container.deployModule("io.vertx~mod-mongo-persistor~2.1.1", mongo_config);

var server = vertx.createHttpServer();

server.requestHandler(function(request) {
    console.log('An HTTP request has been received');
    var query = {
        "action": "find",
        "collection": "zips",
        "matcher": {
            "state": "AL"
        }
    };
    eb.send("mongodb-persistor", query, function (message) {
        request.response.end(JSON.stringify(message));
    });
});

server.listen(8080, "localhost");


text:
import React from 'react';
import { RadioField } from 'uniforms-semantic';

import createContext from './_createContext';
import mount from './_mount';

test('<RadioField> - renders a set of checkboxes', () => {
  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
});

test('<RadioField> - renders a set of checkboxes with correct disabled state', () => {
  const element = <RadioField name="x" disabled />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('disabled')).toBe(true);
  expect(wrapper.find('input').at(1).prop('disabled')).toBe(true);
});

test('<RadioField> - renders a set of checkboxes with correct readOnly state', () => {
  const onChange = jest.fn();

  const element = <RadioField name="x" readOnly />;
  const wrapper = mount(
    element,
    createContext(
      { x: { type: String, allowedValues: ['a', 'b'] } },
      { onChange },
    ),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(1).simulate('change')).toBeTruthy();
  expect(onChange).not.toHaveBeenCalled();
});

test('<RadioField> - renders a set of checkboxes with correct id (inherited)', () => {
  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('id')).toBeTruthy();
  expect(wrapper.find('input').at(1).prop('id')).toBeTruthy();
});

test('<RadioField> - renders a set of checkboxes with correct id (specified)', () => {
  const element = <RadioField name="x" id="y" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('id')).toBe('y-YQ');
  expect(wrapper.find('input').at(1).prop('id')).toBe('y-Yg');
});

test('<RadioField> - renders a set of checkboxes with correct name', () => {
  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('name')).toBe('x');
  expect(wrapper.find('input').at(1).prop('name')).toBe('x');
});

test('<RadioField> - renders a set of checkboxes with correct options', () => {
  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('label')).toHaveLength(2);
  expect(wrapper.find('label').at(0).text()).toBe('a');
  expect(wrapper.find('label').at(1).text()).toBe('b');
});

test('<RadioField> - renders a set of checkboxes with correct options (transform)', () => {
  const element = <RadioField name="x" transform={x => x.toUpperCase()} />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('label')).toHaveLength(2);
  expect(wrapper.find('label').at(0).text()).toBe('A');
  expect(wrapper.find('label').at(1).text()).toBe('B');
});

test('<RadioField> - renders a set of checkboxes with correct value (default)', () => {
  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('checked')).toBe(false);
  expect(wrapper.find('input').at(1).prop('checked')).toBe(false);
});

test('<RadioField> - renders a set of checkboxes with correct value (model)', () => {
  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext(
      { x: { type: String, allowedValues: ['a', 'b'] } },
      { model: { x: 'b' } },
    ),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('checked')).toBe(false);
  expect(wrapper.find('input').at(1).prop('checked')).toBe(true);
});

test('<RadioField> - renders a set of checkboxes with correct value (specified)', () => {
  const element = <RadioField name="x" value="b" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).prop('checked')).toBe(false);
  expect(wrapper.find('input').at(1).prop('checked')).toBe(true);
});

test('<RadioField> - renders a set of checkboxes which correctly reacts on change', () => {
  const onChange = jest.fn();

  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext(
      { x: { type: String, allowedValues: ['a', 'b'] } },
      { onChange },
    ),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(1).simulate('change')).toBeTruthy();
  expect(onChange).toHaveBeenLastCalledWith('x', 'b');
});

test('<RadioField> - renders a set of checkboxes which correctly reacts on change (same value)', () => {
  const onChange = jest.fn();

  const element = <RadioField name="x" />;
  const wrapper = mount(
    element,
    createContext(
      { x: { type: String, allowedValues: ['a', 'b'] } },
      { model: { x: 'b' }, onChange },
    ),
  );

  expect(wrapper.find('input')).toHaveLength(2);
  expect(wrapper.find('input').at(0).simulate('change')).toBeTruthy();
  expect(onChange).toHaveBeenLastCalledWith('x', 'a');
});

test('<RadioField> - renders a label', () => {
  const element = <RadioField name="x" label="y" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('label')).toHaveLength(3);
  expect(wrapper.find('label').at(0).text()).toBe('y');
});

test('<RadioField> - renders a wrapper with unknown props', () => {
  const element = <RadioField name="x" data-x="x" data-y="y" data-z="z" />;
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('div').at(0).prop('data-x')).toBe('x');
  expect(wrapper.find('div').at(0).prop('data-y')).toBe('y');
  expect(wrapper.find('div').at(0).prop('data-z')).toBe('z');
});

test('<RadioField> - renders correct error text (specified)', () => {
  const error = new Error();
  const element = (
    <RadioField name="x" error={error} showInlineError errorMessage="Error" />
  );
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('.ui.red.label').length).toBe(1);
  expect(wrapper.find('.ui.red.label').text()).toBe('Error');
});

test('<RadioField> - renders correct error text (showInlineError=false)', () => {
  const error = new Error();
  const element = (
    <RadioField
      name="x"
      error={error}
      showInlineError={false}
      errorMessage="Error"
    />
  );
  const wrapper = mount(
    element,
    createContext({ x: { type: String, allowedValues: ['a', 'b'] } }),
  );

  expect(wrapper.find('.ui.red.label').length).toBe(0);
});

test('<RadioField> - works with special characters', () => {
  mount(
    <RadioField name="x" />,
    createContext({ x: { type: String, allowedValues: ['ă', 'ș'] } }),
  );
});

redpajama_set_name: RedPajamaGithub


text:
class GtkPortLabel : public GtkPortMisc
{
public:
    GtkPortLabel(const std::string &text);
    virtual ~GtkPortLabel();

    //!E8.Property Text|Текст get:GetText set:SetText
    E8::Variant GetText() const;
    void SetText(E8_IN Text);

    virtual GtkWidget *GetWidget();
protected:
private:
    GtkLabel *obj;
};
//!E8.EndClass

#endif // GTKPORTLABEL_HPP


text:
WebJar for paper-input

More info: http://webjars.org
Upstream:  https://github.com/PolymerElements/paper-input


text:
package buildbucket

import (
	"context"
	"testing"

	. "github.com/smartystreets/goconvey/convey"
	"go.chromium.org/luci/auth/identity"
	"go.chromium.org/luci/buildbucket/bbperms"
	buildbucketpb "go.chromium.org/luci/buildbucket/proto"
	"go.chromium.org/luci/server/auth"
	"go.chromium.org/luci/server/auth/authtest"
)

const testIdentity = identity.Identity("user:test@example.com")

func TestFilterVisibleBuilders(t *testing.T) {
	t.Parallel()

	Convey(`FilterVisibleBuilders`, t, func() {
		s := &authtest.FakeState{
			FakeDB: authtest.NewFakeDB(
				authtest.MockPermission(testIdentity, "proj1:bucket1", bbperms.BuildersList),
				authtest.MockPermission(testIdentity, "proj2:bucket1", bbperms.BuildersList),
			),
			Identity: testIdentity,
		}
		ctx := auth.WithState(context.Background(), s)

		builders := []*buildbucketpb.BuilderID{
			{
				Project: "proj1",
				Bucket:  "bucket1",
				Builder: "builder1",
			},
			{
				Project: "proj1",
				Bucket:  "bucket2",
				Builder: "builder1",
			},
			{
				Project: "proj2",
				Bucket:  "bucket1",
				Builder: "builder1",
			},
			{
				Project: "proj2",
				Bucket:  "bucket1",
				Builder: "builder2",
			},
			{
				Project: "proj2",
				Bucket:  "bucket2",
				Builder: "builder1",
			},
		}

		visibleBuilders, err := FilterVisibleBuilders(ctx, builders, "")
		So(err, ShouldBeNil)
		So(visibleBuilders, ShouldResemble, []*buildbucketpb.BuilderID{
			{
				Project: "proj1",
				Bucket:  "bucket1",
				Builder: "builder1",
			},
			{
				Project: "proj2",
				Bucket:  "bucket1",
				Builder: "builder1",
			},
			{
				Project: "proj2",
				Bucket:  "bucket1",
				Builder: "builder2",
			},
		})

		visibleBuildersInProj2, err := FilterVisibleBuilders(ctx, builders, "proj2")
		So(err, ShouldBeNil)
		So(visibleBuildersInProj2, ShouldResemble, []*buildbucketpb.BuilderID{
			{
				Project: "proj2",
				Bucket:  "bucket1",
				Builder: "builder1",
			},
			{
				Project: "proj2",
				Bucket:  "bucket1",
				Builder: "builder2",
			},
		})
	})
}


text:
package org.onehippo.forge.folderctxmenus.common;

import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;

import javax.jcr.ItemNotFoundException;
import javax.jcr.Node;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
import javax.jcr.Value;

import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.hippoecm.repository.util.JcrUtils;

public class FolderCopyTask extends AbstractFolderCopyOrMoveTask {

    public FolderCopyTask(final Session session, final Locale locale, final Node sourceFolderNode,
            final Node destParentFolderNode, final String destFolderNodeName, final String destFolderDisplayName) {
        super(session, locale, sourceFolderNode, destParentFolderNode, destFolderNodeName, destFolderDisplayName);
    }

    @Override
    protected void doExecute() throws RepositoryException {
        if (getSourceFolderNode().getParent().isSame(getDestParentFolderNode())) {
            if (StringUtils.equals(getSourceFolderNode().getName(), getDestFolderNodeName())) {
                throw new RuntimeException("Cannot copy to the same folder: " + getDestParentFolderNode().getPath()
                        + " / " + getDestFolderNodeName());
            }
        }

        if (getSourceFolderNode().isSame(getDestParentFolderNode())) {
            throw new RuntimeException("Cannot copy to the folder itself: " + getDestFolderPath());
        }

        if (getSession().nodeExists(getDestFolderPath())) {
            throw new RuntimeException("Destination folder already exists: " + getDestFolderPath());
        }

        getLogger().info("Copying nodes: from {} to {}.", getSourceFolderNode().getPath(), getDestFolderPath());

        if (getCopyHandler() != null) {
            JcrCopyUtils.copy(getSourceFolderNode(), getDestFolderNodeName(), getDestParentFolderNode(),
                    getCopyHandler());
        } else {
            JcrCopyUtils.copy(getSourceFolderNode(), getDestFolderNodeName(), getDestParentFolderNode());
        }

        setDestFolderNode(JcrUtils.getNodeIfExists(getDestParentFolderNode(), getDestFolderNodeName()));

        updateFolderTranslations(getDestFolderNode(), getDestFolderDisplayName(), getLocale().getLanguage());
    }

    @Override
    protected void doAfterExecute() throws RepositoryException {
        resetHippoDocBaseLinks();
        takeOfflineHippoDocs();
        resetHippoDocumentTranslationIds();
    }

    /**
     * Search all the hippotranslation:translated nodes under {@code destFolderNode} including {@code destFolderNode}
     * and reset the hippotranslation:id property to a newly generate UUID.
     */
    protected void resetHippoDocumentTranslationIds() {
        String destFolderNodePath = null;

        try {
            destFolderNodePath = getDestFolderNode().getPath();

            final Map<String, String> uuidMappings = new HashMap<String, String>();

            resetHippoTranslatedNodeWithNewUuid(getDestFolderNode(), uuidMappings);

            JcrTraverseUtils.traverseNodes(getDestFolderNode(),
                    new NodeTraverser() {
                        @Override
                        public boolean isAcceptable(Node node) throws RepositoryException {
                            return node.isNodeType("hippotranslation:translated");
                        }

                        @Override
                        public boolean isTraversable(Node node) throws RepositoryException {
                            return !node.isNodeType("hippostdpubwf:document");
                        }

                        @Override
                        public void accept(Node translatedNode) throws RepositoryException {
                            resetHippoTranslatedNodeWithNewUuid(translatedNode, uuidMappings);
                        }
                    });
        } catch (RepositoryException e) {
            getLogger().error("Failed to reset hippotranslation:id properties under {}.", destFolderNodePath, e);
        }
    }

    private void resetHippoTranslatedNodeWithNewUuid(final Node translatedNode, final Map<String, String> uuidMappings)
            throws RepositoryException {
        if (translatedNode != null && translatedNode.isNodeType("hippotranslation:translated")) {
            String translationUuid = JcrUtils.getStringProperty(translatedNode, "hippotranslation:id", null);

            if (UUIDUtils.isValidPattern(translationUuid)) {
                String newTranslationUuid;

                if (uuidMappings.containsKey(translationUuid)) {
                    newTranslationUuid = uuidMappings.get(translationUuid);
                } else {
                    newTranslationUuid = UUID.randomUUID().toString();
                    uuidMappings.put(translationUuid, newTranslationUuid);
                }

                translatedNode.setProperty("hippotranslation:id", newTranslationUuid);
            }
        }
    }

    /**
     * Search all the link holder nodes having hippo:docbase property under destFolderNode
     * and reset the hippo:docbase properties to the copied nodes under destFolderNode
     * by comparing the relative paths with the corresponding nodes under the sourceFolderNode.
     */
    protected void resetHippoDocBaseLinks() {
        String destFolderNodePath = null;

        try {
            destFolderNodePath = getDestFolderNode().getPath();

            JcrTraverseUtils.traverseNodes(getDestFolderNode(),
                    new NodeTraverser() {
                        private String sourceFolderBase = getSourceFolderNode().getPath() + "/";

                        @Override
                        public boolean isAcceptable(Node node) throws RepositoryException {
                            return node.isNodeType("hippo:mirror") && node.hasProperty("hippo:docbase");
                        }

                        @Override
                        public boolean isTraversable(Node node) throws RepositoryException {
                            return !node.isNodeType("hippo:mirror");
                        }

                        @Override
                        public void accept(Node destLinkHolderNode) throws RepositoryException {
                            String destLinkDocBase = JcrUtils.getStringProperty(destLinkHolderNode, "hippo:docbase", null);

                            if (StringUtils.isNotBlank(destLinkDocBase)) {
                                try {
                                    Node sourceLinkedNode = getSession().getNodeByIdentifier(destLinkDocBase);

                                    if (StringUtils.startsWith(sourceLinkedNode.getPath(), sourceFolderBase)) {
                                        String sourceLinkedNodeRelPath = StringUtils.removeStart(sourceLinkedNode.getPath(),
                                                sourceFolderBase);
                                        Node destLinkedNode = JcrUtils.getNodeIfExists(getDestFolderNode(), sourceLinkedNodeRelPath);

                                        if (destLinkedNode != null) {
                                            getLogger().info("Updating the linked node at '{}'.", destLinkHolderNode.getPath());
                                            destLinkHolderNode.setProperty("hippo:docbase", destLinkedNode.getIdentifier());
                                        }
                                    }
                                } catch (ItemNotFoundException ignore) {
                                }
                            }
                        }
                    });
        } catch (RepositoryException e) {
            getLogger().error("Failed to reset link Nodes under destination folder: {}.", destFolderNodePath, e);
        }
    }

    /**
     * Takes offline all the hippo documents under the {@code destFolderNode}.
     */
    protected void takeOfflineHippoDocs() {
        String destFolderNodePath = null;

        try {
            destFolderNodePath = getDestFolderNode().getPath();

            JcrTraverseUtils.traverseNodes(getDestFolderNode(),
                    new NodeTraverser() {
                        @Override
                        public boolean isAcceptable(Node node) throws RepositoryException {
                            if (!node.isNodeType("hippostdpubwf:document")) {
                                return false;
                            }

                            return isLiveVariantNode(node) &&
                                    StringUtils.equals("published", JcrUtils.getStringProperty(node, "hippostd:state", null));
                        }

                        @Override
                        public boolean isTraversable(Node node) throws RepositoryException {
                            return !node.isNodeType("hippostdpubwf:document");
                        }

                        private boolean isLiveVariantNode(final Node variantNode) throws RepositoryException {
                            if (variantNode.hasProperty("hippo:availability")) {
                                for (Value value : variantNode.getProperty("hippo:availability").getValues()) {
                                    if (StringUtils.equals("live", value.getString())) {
                                        return true;
                                    }
                                }
                            }

                            return false;
                        }

                        @Override
                        public void accept(Node liveVariant) throws RepositoryException {
                            liveVariant.setProperty("hippo:availability", ArrayUtils.EMPTY_STRING_ARRAY);
                            liveVariant.setProperty("hippostd:stateSummary", "new");
                        }
                    });
        } catch (RepositoryException e) {
            getLogger().error("Failed to take offline link hippostd:publishableSummary nodes under {}.", destFolderNodePath, e);
        }
    }

}