text:
package nam.model._import;

import java.io.Serializable;

import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.commons.lang.StringUtils;
import org.aries.runtime.BeanContext;
import org.aries.ui.AbstractPageManager;
import org.aries.ui.AbstractWizardPage;
import org.aries.ui.Breadcrumb;
import org.aries.util.NameUtil;

import nam.model.Import;
import nam.model.util.ImportUtil;
import nam.ui.design.SelectionContext;

@SessionScoped
@Named("importPageManager")
public class ImportPageManager extends AbstractPageManager<Import> implements Serializable {

	@Inject
	private ImportWizard importWizard;

	@Inject
	private ImportDataManager importDataManager;

	@Inject
	private ImportListManager importListManager;

	@Inject
	private ImportRecord_OverviewSection importOverviewSection;

	@Inject
	private ImportRecord_IdentificationSection importIdentificationSection;

	@Inject
	private ImportRecord_ConfigurationSection importConfigurationSection;

	@Inject
	private ImportRecord_DocumentationSection importDocumentationSection;

	@Inject
	private SelectionContext selectionContext;

	public ImportPageManager() {
		initializeSections();
		initializeDefaultView();
	}

	public void refresh() {
		refresh("import");
	}

	public void refreshLocal() {
		refreshLocal("import");
	}

	public void refreshMembers() {
		refreshMembers("import");
	}

	public void refresh(String scope) {
		refreshLocal(scope);
		refreshMembers(scope);
	}

	public void refreshLocal(String scope) {
		importDataManager.setScope(scope);
		importListManager.refresh();
	}

	public void refreshMembers(String scope) {
		importListManager.refresh();
	}

	public String getImportListPage() {
		return "/nam/model/_import/importListPage.xhtml";
	}

	public String getImportTreePage() {
		return "/nam/model/_import/importTreePage.xhtml";
	}

	public String getImportSummaryPage() {
		return "/nam/model/_import/importSummaryPage.xhtml";
	}

	public String getImportRecordPage() {
		return "/nam/model/_import/importRecordPage.xhtml";
	}

	public String getImportWizardPage() {
		return "/nam/model/_import/importWizardPage.xhtml";
	}

	public String getImportManagementPage() {
		return "/nam/model/_import/importManagementPage.xhtml";
	}

	public String initializeImportListPage() {
		String pageLevelKey = "importList";
		clearBreadcrumbs(pageLevelKey);
		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportManagementPage()");
		String url = getImportListPage();
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		sections.clear();
		return url;
	}

	public String initializeImportTreePage() {
		String pageLevelKey = "importTree";
		clearBreadcrumbs(pageLevelKey);
		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportTreePage()");
		String url = getImportTreePage();
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		sections.clear();
		return url;
	}

	public String initializeImportSummaryPage(Import _import) {
		String pageLevelKey = "importSummary";
		clearBreadcrumbs(pageLevelKey);
		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportSummaryPage()");
		String url = getImportSummaryPage();
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		sections.clear();
		return url;
	}

	public String initializeImportRecordPage() {
		Import _import = selectionContext.getSelection("import");
		String importName = ImportUtil.getLabel(_import);

		String pageLevelKey = "importRecord";
		clearBreadcrumbs(pageLevelKey);
		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportManagementPage()");
		addBreadcrumb(pageLevelKey, importName, "showImportRecordPage()");
		String url = getImportRecordPage();
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		initializeDefaultView();
		sections.clear();
		return url;
	}

	public String initializeImportCreationPage(Import _import) {
		setPageTitle("New "+getImportLabel(_import));
		setPageIcon("/icons/nam/NewImport16.gif");
		setSectionTitle("Import Identification");
		importWizard.setNewMode(true);

		String pageLevelKey = "import";
		String wizardLevelKey = "importWizard";
		clearBreadcrumbs(pageLevelKey);
		clearBreadcrumbs(wizardLevelKey);

		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportManagementPage()");
		addBreadcrumb(pageLevelKey, new Breadcrumb("New Import", "showImportWizardPage()"));

		addBreadcrumb(wizardLevelKey, "Identification", "showImportWizardPage('Identification')");
		addBreadcrumb(wizardLevelKey, "Configuration", "showImportWizardPage('Configuration')");
		addBreadcrumb(wizardLevelKey, "Documentation", "showImportWizardPage('Documentation')");

		importIdentificationSection.setOwner("importWizard");
		importConfigurationSection.setOwner("importWizard");
		importDocumentationSection.setOwner("importWizard");

		sections.clear();
		sections.add(importIdentificationSection);
		sections.add(importConfigurationSection);
		sections.add(importDocumentationSection);

		String url = getImportWizardPage() + "?section=Identification";
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		//selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		refresh();
		return url;
	}

	public String initializeImportUpdatePage(Import _import) {
		setPageTitle(getImportLabel(_import));
		setPageIcon("/icons/nam/Import16.gif");
		setSectionTitle("Import Overview");
		String importName = ImportUtil.getLabel(_import);
		importWizard.setNewMode(false);

		String pageLevelKey = "import";
		String wizardLevelKey = "importWizard";
		clearBreadcrumbs(pageLevelKey);
		clearBreadcrumbs(wizardLevelKey);

		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportManagementPage()");
		addBreadcrumb(pageLevelKey, new Breadcrumb(importName, "showImportWizardPage()"));

		addBreadcrumb(wizardLevelKey, "Overview", "showImportWizardPage('Overview')");
		addBreadcrumb(wizardLevelKey, "Identification", "showImportWizardPage('Identification')");
		addBreadcrumb(wizardLevelKey, "Configuration", "showImportWizardPage('Configuration')");
		addBreadcrumb(wizardLevelKey, "Documentation", "showImportWizardPage('Documentation')");

		importOverviewSection.setOwner("importWizard");
		importIdentificationSection.setOwner("importWizard");
		importConfigurationSection.setOwner("importWizard");
		importDocumentationSection.setOwner("importWizard");

		sections.clear();
		sections.add(importOverviewSection);
		sections.add(importIdentificationSection);
		sections.add(importConfigurationSection);
		sections.add(importDocumentationSection);

		String url = getImportWizardPage() + "?section=Overview";
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		//selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		refresh();
		return url;
	}

	public String initializeImportManagementPage() {
		setPageTitle("Imports");
		setPageIcon("/icons/nam/Import16.gif");
		String pageLevelKey = "importManagement";
		clearBreadcrumbs(pageLevelKey);
		addBreadcrumb(pageLevelKey, "Top", "showMainPage()");
		addBreadcrumb(pageLevelKey, "Imports", "showImportManagementPage()");
		String url = getImportManagementPage();
		selectionContext.setCurrentArea("import");
		selectionContext.setSelectedArea(pageLevelKey);
		selectionContext.setMessageDomain(pageLevelKey);
		selectionContext.resetOrigin();
		selectionContext.setUrl(url);
		initializeDefaultView();
		sections.clear();
		refresh();
		return url;
	}

	public void initializeDefaultView() {
		setSectionType("_import");
		setSectionName("Overview");
		setSectionTitle("Overview of Imports");
		setSectionIcon("/icons/nam/Overview16.gif");
	}

	public String initializeImportSummaryView(Import _import) {
		//String viewTitle = getImportLabel(import);
		//String currentArea = selectionContext.getCurrentArea();
		setSectionType("_import");
		setSectionName("Summary");
		setSectionTitle("Summary of Import Records");
		setSectionIcon("/icons/nam/Import16.gif");
		String viewLevelKey = "importSummary";
		clearBreadcrumbs(viewLevelKey);
		addBreadcrumb(viewLevelKey, "Top", "showMainPage()");
		addBreadcrumb(viewLevelKey, "Imports", "showImportManagementPage()");
		selectionContext.setMessageDomain(viewLevelKey);
		sections.clear();
		return null;
	}

	protected String getImportLabel(Import _import) {
		String label = "Import";
		String name = ImportUtil.getLabel(_import);
		if (name != null && !name.isEmpty())
			label = name + " " + label;
		return label;
	}

	protected void updateState() {
		AbstractWizardPage<Import> page = importWizard.getPage();
		if (page != null)
			setSectionTitle("Import " + page.getName());
	}

	protected void updateState(Import _import) {
		String importName = ImportUtil.getLabel(_import);
		setSectionTitle(importName + " Import");
	}

}


text:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Plethora.Linq.Expressions;
using Plethora.Test.UtilityClasses;

namespace Plethora.Test.Linq.Expressions
{
    [TestClass]
    public class ExpressionHelper_Test
    {
        [TestMethod]
        public void GetPropertyName()
        {
            // Arrange
            Person p = default;

            // Action
            var result = ExpressionHelper.GetPropertyName(() => p.FamilyName);

            // Assert
            Assert.AreEqual("FamilyName", result);
        }

        [TestMethod]
        public void GetPropertyName_NestedProperty()
        {
            // Arrange
            Person p = default;

            // Action
            var result = ExpressionHelper.GetPropertyName(() => p.DateOfBirth.Year);

            // Assert
            Assert.AreEqual("Year", result);
        }

        [TestMethod]
        public void GetPropertyName_IndirectType()
        {
            // Arrange

            // Action
            var result = ExpressionHelper.GetPropertyName<Person, string>(person => person.FamilyName);

            // Assert
            Assert.AreEqual("FamilyName", result);
        }

        [TestMethod]
        public void GetFieldName()
        {
            // Arrange
            Record r = default;

            // Action
            var result = ExpressionHelper.GetFieldName(() => r.Name);

            // Assert
            Assert.AreEqual("Name", result);
        }

        [TestMethod]
        public void GetPropertyOrFieldName_Property()
        {
            // Arrange
            Person p = default;

            // Action
            var result = ExpressionHelper.GetPropertyOrFieldName(() => p.FamilyName);

            // Assert
            Assert.AreEqual("FamilyName", result);
        }

        [TestMethod]
        public void GetPropertyOrFieldName_Field()
        {
            // Arrange
            Record r = default;

            // Action
            var result = ExpressionHelper.GetPropertyOrFieldName(() => r.Name);

            // Assert
            Assert.AreEqual("Name", result);
        }

        [TestMethod]
        public void GetPropertyOrFieldName_Property_NestedProperty()
        {
            // Arrange
            Person p = default;

            // Action
            var result = ExpressionHelper.GetPropertyOrFieldName(() => p.DateOfBirth.Year);

            // Assert
            Assert.AreEqual("Year", result);
        }

        [TestMethod]
        public void GetPropertyOrFieldName_Property_IndirectType()
        {
            // Arrange

            // Action
            var result = ExpressionHelper.GetPropertyOrFieldName<Person, string>(person => person.FamilyName);

            // Assert
            Assert.AreEqual("FamilyName", result);
        }

        private class Record
        {
            public int Name;
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
require 'spec_helper'

shared_examples 'Webhook Events API' do

  it "matches the list of webhooks with the folder of fixtures" do
    events = StripeMock::Webhooks.event_list.to_set
    file_names = Dir['./lib/stripe_mock/webhook_fixtures/*'].map {|f| File.basename(f, '.json')}.to_set
    # The reason we take the difference instead of compare equal is so
    # that a missing event name will show up in the test failure report.
    expect(events - file_names).to eq(Set.new)
    expect(file_names - events).to eq(Set.new)
  end

  it "first looks in spec/fixtures/stripe_webhooks/ for fixtures by default" do
    event = StripeMock.mock_webhook_event('account.updated')
    payload = StripeMock.mock_webhook_payload('account.updated')
    expect(event).to be_a(Stripe::Event)
    expect(event.id).to match /^test_evt_[0-9]+/
    expect(event.type).to eq('account.updated')

    expect(payload).to be_a(Hash)
    expect(payload[:id]).to match /^test_evt_[0-9]+/
    expect(payload[:type]).to eq('account.updated')
  end

  it "allows non-standard event names in the project fixture folder" do
    expect {
      event = StripeMock.mock_webhook_event('custom.account.updated')
      StripeMock.mock_webhook_payload('custom.account.updated')
    }.to_not raise_error
  end

  it "allows configuring the project fixture folder" do
    original_path = StripeMock.webhook_fixture_path

    StripeMock.webhook_fixture_path = './spec/_dummy/webhooks/'
    expect(StripeMock.webhook_fixture_path).to eq('./spec/_dummy/webhooks/')

    event = StripeMock.mock_webhook_event('dummy.event')
    payload = StripeMock.mock_webhook_payload('dummy.event')
    expect(event.val).to eq('success')
    expect(payload[:val]).to eq('success')

    StripeMock.webhook_fixture_path = original_path
  end

  it "generates an event and stores it in memory" do
    event = StripeMock.mock_webhook_event('customer.created')
    expect(event).to be_a(Stripe::Event)
    expect(event.id).to_not be_nil

    data = test_data_source(:events)
    expect(data[event.id]).to_not be_nil
    expect(data[event.id][:id]).to eq(event.id)
    expect(data[event.id][:type]).to eq('customer.created')
  end

  it "generates an id for a new event" do
    event_a = StripeMock.mock_webhook_event('customer.created')
    event_b = StripeMock.mock_webhook_event('customer.created')
    expect(event_a.id).to_not be_nil
    expect(event_a.id).to_not eq(event_b.id)

    data = test_data_source(:events)
    expect(data[event_a.id]).to_not be_nil
    expect(data[event_a.id][:id]).to eq(event_a.id)

    expect(data[event_b.id]).to_not be_nil
    expect(data[event_b.id][:id]).to eq(event_b.id)
  end

  it "handles stripe connect event when account is present" do
  	acc_12314 = 'acc_12314'
    event = StripeMock.mock_webhook_event('customer.created', account: acc_12314)
    expect(event[:account]).to eq(acc_12314)
  end

  it "retrieves an eveng using the event resource" do
    webhook_event = StripeMock.mock_webhook_event('plan.created')
    expect(webhook_event.id).to_not be_nil

    event = Stripe::Event.retrieve(webhook_event.id)
    expect(event).to_not be_nil
    expect(event.type).to eq 'plan.created'
  end

  it "takes a hash and deep merges into the data object" do
    event = StripeMock.mock_webhook_event('customer.created', {
      :account_balance => 12345
    })
    payload = StripeMock.mock_webhook_event('customer.created', {
      :account_balance => 12345
    })
    expect(event.data.object.account_balance).to eq(12345)
    expect(payload[:data][:object][:account_balance]).to eq(12345)
  end

  it "takes a hash and deep merges arrays in the data object" do
    event = StripeMock.mock_webhook_event('invoice.created', {
      :lines => {
        :data => [
          { :amount => 555,
            :plan => { :id => 'wh_test' }
          }
        ]
      }
    })
    expect(event.data.object.lines.data.first.amount).to eq(555)
    expect(event.data.object.lines.data.first.plan.id).to eq('wh_test')
    # Ensure data from invoice.created.json is still present
    expect(event.data.object.lines.data.first.type).to eq('subscription')
    expect(event.data.object.lines.data.first.plan.currency).to eq('usd')
  end

  it "can generate all events" do
    StripeMock::Webhooks.event_list.each do |event_name|
      expect { StripeMock.mock_webhook_event(event_name) }.to_not raise_error
    end
  end

  it "raises an error for non-existant event types" do
    expect {
      event = StripeMock.mock_webhook_event('cow.bell')
    }.to raise_error StripeMock::UnsupportedRequestError

    expect {
      StripeMock.mock_webhook_payload('cow.bell')
    }.to raise_error StripeMock::UnsupportedRequestError
  end

  it 'has actual created attribute' do
    time = Time.now.to_i

    evnt = StripeMock.mock_webhook_event('customer.subscription.updated')

    expect(evnt.created).to eq time
  end

  it 'when created param can be overrided' do
    time = Time.now.to_i - 1000

    evnt = StripeMock.mock_webhook_event('customer.subscription.updated', created: time)

    expect(evnt.created).to eq time
  end

  describe "listing events" do

    it "retrieves all events" do
      customer_created_event = StripeMock.mock_webhook_event('customer.created')
      expect(customer_created_event).to be_a(Stripe::Event)
      expect(customer_created_event.id).to_not be_nil

      plan_created_event = StripeMock.mock_webhook_event('plan.created')
      expect(plan_created_event).to be_a(Stripe::Event)
      expect(plan_created_event.id).to_not be_nil

      coupon_created_event = StripeMock.mock_webhook_event('coupon.created')
      expect(coupon_created_event).to be_a(Stripe::Event)
      expect(coupon_created_event).to_not be_nil

      invoice_created_event = StripeMock.mock_webhook_event('invoice.created')
      expect(invoice_created_event).to be_a(Stripe::Event)
      expect(invoice_created_event).to_not be_nil

      invoice_item_created_event = StripeMock.mock_webhook_event('invoiceitem.created')
      expect(invoice_item_created_event).to be_a(Stripe::Event)
      expect(invoice_item_created_event).to_not be_nil

      events = Stripe::Event.list

      expect(events.count).to eq(5)
      expect(events.map &:id).to include(customer_created_event.id, plan_created_event.id, coupon_created_event.id, invoice_created_event.id, invoice_item_created_event.id)
      expect(events.map &:type).to include('customer.created', 'plan.created', 'coupon.created', 'invoice.created', 'invoiceitem.created')
    end

    it "retrieves events with a limit(3)" do
      customer_created_event = StripeMock.mock_webhook_event('customer.created')
      expect(customer_created_event).to be_a(Stripe::Event)
      expect(customer_created_event.id).to_not be_nil

      plan_created_event = StripeMock.mock_webhook_event('plan.created')
      expect(plan_created_event).to be_a(Stripe::Event)
      expect(plan_created_event.id).to_not be_nil

      coupon_created_event = StripeMock.mock_webhook_event('coupon.created')
      expect(coupon_created_event).to be_a(Stripe::Event)
      expect(coupon_created_event).to_not be_nil

      invoice_created_event = StripeMock.mock_webhook_event('invoice.created')
      expect(invoice_created_event).to be_a(Stripe::Event)
      expect(invoice_created_event).to_not be_nil

      invoice_item_created_event = StripeMock.mock_webhook_event('invoiceitem.created')
      expect(invoice_item_created_event).to be_a(Stripe::Event)
      expect(invoice_item_created_event).to_not be_nil

      events = Stripe::Event.list(limit: 3)

      expect(events.count).to eq(3)
      expect(events.map &:id).to include(invoice_item_created_event.id, invoice_created_event.id, coupon_created_event.id)
      expect(events.map &:type).to include('invoiceitem.created', 'invoice.created', 'coupon.created')
    end

  end

  describe 'Subscription events' do
    it "Checks for billing items in customer.subscription.created" do
      subscription_created_event = StripeMock.mock_webhook_event('customer.subscription.created')
      expect(subscription_created_event).to be_a(Stripe::Event)
      expect(subscription_created_event.id).to_not be_nil
      expect(subscription_created_event.data.object.items.data.class).to be Array
      expect(subscription_created_event.data.object.items.data.length).to be 2
      expect(subscription_created_event.data.object.items.data.first).to respond_to(:plan)
      expect(subscription_created_event.data.object.items.data.first.id).to eq('si_00000000000000')
    end

    it "Checks for billing items in customer.subscription.deleted" do
      subscription_deleted_event = StripeMock.mock_webhook_event('customer.subscription.deleted')
      expect(subscription_deleted_event).to be_a(Stripe::Event)
      expect(subscription_deleted_event.id).to_not be_nil
      expect(subscription_deleted_event.data.object.items.data.class).to be Array
      expect(subscription_deleted_event.data.object.items.data.length).to be 2
      expect(subscription_deleted_event.data.object.items.data.first).to respond_to(:plan)
      expect(subscription_deleted_event.data.object.items.data.first.id).to eq('si_00000000000000')
    end

    it "Checks for billing items in customer.subscription.updated" do
      subscription_updated_event = StripeMock.mock_webhook_event('customer.subscription.updated')
      expect(subscription_updated_event).to be_a(Stripe::Event)
      expect(subscription_updated_event.id).to_not be_nil
      expect(subscription_updated_event.data.object.items.data.class).to be Array
      expect(subscription_updated_event.data.object.items.data.length).to be 2
      expect(subscription_updated_event.data.object.items.data.first).to respond_to(:plan)
      expect(subscription_updated_event.data.object.items.data.first.id).to eq('si_00000000000000')
    end

    it "Checks for billing items in customer.subscription.trial_will_end" do
      subscription_trial_will_end_event = StripeMock.mock_webhook_event('customer.subscription.trial_will_end')
      expect(subscription_trial_will_end_event).to be_a(Stripe::Event)
      expect(subscription_trial_will_end_event.id).to_not be_nil
      expect(subscription_trial_will_end_event.data.object.items.data.class).to be Array
      expect(subscription_trial_will_end_event.data.object.items.data.length).to be 2
      expect(subscription_trial_will_end_event.data.object.items.data.first).to respond_to(:plan)
      expect(subscription_trial_will_end_event.data.object.items.data.first.id).to eq('si_00000000000000')
    end
  end

  describe 'Invoices events' do
    it "Checks for billing items in invoice.payment_succeeded" do
      invoice_payment_succeeded = StripeMock.mock_webhook_event('invoice.payment_succeeded')
      expect(invoice_payment_succeeded).to be_a(Stripe::Event)
      expect(invoice_payment_succeeded.id).to_not be_nil
      expect(invoice_payment_succeeded.data.object.lines.data.class).to be Array
      expect(invoice_payment_succeeded.data.object.lines.data.length).to be 2
      expect(invoice_payment_succeeded.data.object.lines.data.first).to respond_to(:plan)
      expect(invoice_payment_succeeded.data.object.lines.data.first.id).to eq('sub_00000000000000')
    end
  end
end


text:
class Actress < Actor
end


text:
#include <PostMeshBase.hpp>

PostMeshBase::PostMeshBase(const PostMeshBase& other) \
    noexcept(std::is_copy_constructible<PostMeshBase>::value): \
    scale(other.scale), condition(other.condition), \
    projection_precision(other.projection_precision)
{
    // COPY CONSTRUCTOR
    this->mesh_element_type = other.mesh_element_type;
    this->ndim = other.ndim;
    this->mesh_elements = other.mesh_elements;
    this->mesh_points = other.mesh_points;
    this->mesh_edges = other.mesh_edges;
    this->mesh_faces = other.mesh_faces;
    this->projection_criteria = other.projection_criteria;
    this->degree = other.degree;
    this->imported_shape = other.imported_shape;
    this->no_of_shapes = other.no_of_shapes;
    this->geometry_points = other.geometry_points;
    this->geometry_curves = other.geometry_curves;
    this->geometry_surfaces = other.geometry_surfaces;
    this->geometry_curves_types = other.geometry_curves_types;
    this->geometry_surfaces_types = other.geometry_surfaces_types;
    this->displacements_BC = other.displacements_BC;
    this->index_nodes = other.index_nodes;
    this->nodes_dir = other.nodes_dir;
    this->fekete = other.fekete;
}

PostMeshBase& PostMeshBase::operator=(const PostMeshBase& other) \
noexcept(std::is_copy_assignable<PostMeshBase>::value)
{
    // COPY ASSIGNMENT OPERATOR
    this->scale = other.scale;
    this->condition = other.condition;
    this->projection_precision = other.projection_precision;

    this->mesh_element_type = other.mesh_element_type;
    this->ndim = other.ndim;
    this->mesh_elements = other.mesh_elements;
    this->mesh_points = other.mesh_points;
    this->mesh_edges = other.mesh_edges;
    this->mesh_faces = other.mesh_faces;
    this->projection_criteria = other.projection_criteria;
    this->degree = other.degree;
    this->imported_shape = other.imported_shape;
    this->no_of_shapes = other.no_of_shapes;
    this->geometry_points = other.geometry_points;
    this->geometry_curves = other.geometry_curves;
    this->geometry_surfaces = other.geometry_surfaces;
    this->geometry_curves_types = other.geometry_curves_types;
    this->geometry_surfaces_types = other.geometry_surfaces_types;
    this->displacements_BC = other.displacements_BC;
    this->index_nodes = other.index_nodes;
    this->nodes_dir = other.nodes_dir;
    this->fekete = other.fekete;

    return *this;
}

PostMeshBase::PostMeshBase(PostMeshBase&& other) noexcept :  \
    scale(other.scale), condition(other.condition), \
    projection_precision(other.projection_precision)
{
    // MOVE CONSTRUCTOR
    this->mesh_element_type = other.mesh_element_type;
    this->ndim = other.ndim;
    this->mesh_elements = std::move(other.mesh_elements);
    this->mesh_points = std::move(other.mesh_points);
    this->mesh_edges = std::move(other.mesh_edges);
    this->mesh_faces = std::move(other.mesh_faces);
    this->projection_criteria = std::move(other.projection_criteria);
    this->degree = other.degree;
    this->imported_shape = std::move(other.imported_shape);
    this->no_of_shapes = other.no_of_shapes;
    this->geometry_points = std::move(other.geometry_points);
    this->geometry_curves = std::move(other.geometry_curves);
    this->geometry_surfaces = std::move(other.geometry_surfaces);
    this->geometry_curves_types = std::move(other.geometry_curves_types);
    this->geometry_surfaces_types = std::move(other.geometry_surfaces_types);
    this->displacements_BC = std::move(other.displacements_BC);
    this->index_nodes = std::move(other.index_nodes);
    this->nodes_dir = std::move(other.nodes_dir);
    this->fekete = std::move(other.fekete);

    //! NB: CHECK THAT YOUR VERSION OF EIGEN SUPPORTS RVALUE REFERENCES
    //! (EIGEN_HAVE_RVALUE_REFERENCES). In PostMesh this is activated by default.
    //! ACTIVATING/DEACTIVATING DOES NOT AFFECT THE CODE IN ANY WAY COMPATIBILITY-WISE
    //! AS THEN THE COPY CONSTRUCTOR WOULD KICK IN INSTEAD OF MOVE CONSTRUCTOR
}

PostMeshBase& PostMeshBase::operator=(PostMeshBase&& other) noexcept
{
    // MOVE ASSIGNMENT OPERATOR
    this->scale = other.scale;
    this->condition = other.condition;
    this->projection_precision = other.projection_precision;

    this->mesh_element_type = other.mesh_element_type;
    this->ndim = other.ndim;
    this->mesh_elements = std::move(other.mesh_elements);
    this->mesh_points = std::move(other.mesh_points);
    this->mesh_edges = std::move(other.mesh_edges);
    this->mesh_faces = std::move(other.mesh_faces);
    this->projection_criteria = std::move(other.projection_criteria);
    this->degree = other.degree;
    this->imported_shape = std::move(other.imported_shape);
    this->no_of_shapes = other.no_of_shapes;
    this->geometry_points = std::move(other.geometry_points);
    this->geometry_curves = std::move(other.geometry_curves);
    this->geometry_surfaces = std::move(other.geometry_surfaces);
    this->geometry_curves_types = std::move(other.geometry_curves_types);
    this->geometry_surfaces_types = std::move(other.geometry_surfaces_types);
    this->displacements_BC = std::move(other.displacements_BC);
    this->index_nodes = std::move(other.index_nodes);
    this->nodes_dir = std::move(other.nodes_dir);
    this->fekete = std::move(other.fekete);

    //! NB: CHECK THAT YOUR VERSION OF EIGEN SUPPORTS RVALUE REFERENCES
    //! (EIGEN_HAVE_RVALUE_REFERENCES). In PostMesh this is activated by default.
    //! ACTIVATING/DEACTIVATING DOES NOT AFFECT THE CODE IN ANY WAY COMPATIBILITY-WISE
    //! AS THEN THE COPY CONSTRUCTOR WOULD KICK IN INSTEAD OF MOVE CONSTRUCTOR

    return *this;
}

void PostMeshBase::ReadIGES(const char* filename)
{
    //! IGES FILE READER BASED ON OCC BACKEND
    //! THIS FUNCTION CAN BE EXPANDED FURTHER TO TAKE CURVE/SURFACE CONSISTENY INTO ACCOUNT
    //! http://www.opencascade.org/doc/occt-6.7.0/overview/html/user_guides__iges.html

    IGESControl_Reader reader;
    reader.ReadFile(filename);
    // CHECK FOR IMPORT STATUS
    reader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo);
    reader.PrintCheckTransfer(Standard_True,IFSelect_ItemsByEntity);
    // READ IGES FILE AS-IS
    Interface_Static::SetIVal("read.iges.bspline.continuity",0);
    Standard_Integer ic =  Interface_Static::IVal("read.iges.bspline.continuity");
    if (ic !=0)
    {
        std::cerr << "IGES file was not read as-is. The file was not read/transformed correctly\n";
    }

    // FORCE UNITS (NONE SEEM TO WORK)
    //Interface_Static::SetIVal("xstep.cascade.unit",0);
    //Interface_Static::SetIVal("read.scale.unit",0);

    // IF ALL OKAY, THEN TRANSFER ROOTS
    reader.TransferRoots();

    this->imported_shape  = reader.OneShape();
    this->no_of_shapes = reader.NbShapes();
}

void PostMeshBase::ReadSTEP(const char* filename)
{
    //! IGES FILE READER BASED ON OCC BACKEND
    //! THIS FUNCTION CAN BE EXPANDED FURTHER TO TAKE CURVE/SURFACE CONSISTENY INTO ACCOUNT
    //! http://www.opencascade.org/doc/occt-6.7.0/overview/html/user_guides__iges.html

    STEPControl_Reader reader;
    reader.ReadFile(filename);
    // CHECK FOR IMPORT STATUS
    reader.PrintCheckLoad(Standard_True,IFSelect_GeneralInfo);
    reader.PrintCheckTransfer(Standard_True,IFSelect_ItemsByEntity);
    // READ IGES FILE AS-IS
    Interface_Static::SetIVal("read.iges.bspline.continuity",0);
    Standard_Integer ic =  Interface_Static::IVal("read.iges.bspline.continuity");
    if (ic !=0)
    {
        std::cerr << "STEP file was not read as-is. The file was not read/transformed correctly\n";
    }

    // FORCE UNITS (NONE SEEM TO WORK)
    //Interface_Static::SetIVal("xstep.cascade.unit",0);
    //Interface_Static::SetIVal("read.scale.unit",0);

    // IF ALL OKAY, THEN TRANSFER ROOTS
    reader.TransferRoots();

    this->imported_shape  = reader.OneShape();
    this->no_of_shapes = reader.NbShapes();

    //auto edges = reader.GiveList("iges-faces");

}

Eigen::MatrixI PostMeshBase::Read(std::string &filename)
{
    //! Reading 1D integer arrays
    std::vector<std::string> arr;
    arr.clear();
    std::string temp;

    std::ifstream datafile;
    datafile.open(filename.c_str());

    if(!datafile)
    {
        warn("Unable to read file");
    }
    while(datafile)
    {
        datafile >> temp;
        temp += "";
        arr.push_back(temp);
    }

    datafile.close();

    const Integer rows = arr.size();
    const Integer cols = 1;

    Eigen::MatrixI out_arr = Eigen::MatrixI::Zero(rows,cols);

    for(Integer i=0 ; i<rows;i++)
    {
        out_arr(i) = std::atof(arr[i].c_str());
    }

    // CHECK IF LAST LINE IS READ CORRECTLY
    if ( out_arr(out_arr.rows()-2)==out_arr(out_arr.rows()-1) )
    {
        out_arr = out_arr.block(0,0,out_arr.rows()-1,1).eval();
    }

    return out_arr;
}

Eigen::MatrixUI PostMeshBase::ReadI(std::string &filename, char delim)
{
    /*Reading 2D integer row major arrays */
    std::vector<std::string> arr;
    arr.clear();
    std::string temp;

    std::ifstream datafile;
    datafile.open(filename.c_str());

    if(!datafile)
    {
        warn("Unable to read file");
    }
    while(datafile)
    {
        datafile >> temp;
        temp += "";
        arr.push_back(temp);
    }

    datafile.close();

    const Integer rows = arr.size();
    const Integer cols = (split(arr[0], delim)).size();

    Eigen::MatrixUI out_arr = Eigen::MatrixUI::Zero(rows,cols);

    for(Integer i=0 ; i<rows;i++)
    {
        std::vector<std::string> elems;
        elems = split(arr[i], delim);
        for(Integer j=0 ; j<cols;j++)
        {
            out_arr(i,j) = std::atof(elems[j].c_str());
        }
    }

    // CHECK IF LAST LINE IS READ CORRECTLY
    bool duplicate_rows = False;
    for (Integer j=0; j<cols; ++j)
    {
        if ( out_arr(out_arr.rows()-2,j)==out_arr(out_arr.rows()-1,j) )
        {
            duplicate_rows = True;
        }
        else
        {
            duplicate_rows = False;
        }
    }
    if (duplicate_rows == True)
    {
        out_arr = out_arr.block(0,0,out_arr.rows()-1,out_arr.cols()).eval();
    }

    return out_arr;
}

Eigen::MatrixR PostMeshBase::ReadR(std::string &filename, char delim)
{
    /*Reading 2D floating point row major arrays */
    std::vector<std::string> arr;
    arr.clear();
    std::string temp;

    std::ifstream datafile;
    datafile.open(filename.c_str());

    if(!datafile)
    {
        warn("Unable to read file");
    }
    while(datafile)
    {
        datafile >> temp;
        temp += "";
        arr.push_back(temp);
    }

    datafile.close();

    const Integer rows = arr.size();
    const Integer cols = (split(arr[0], delim)).size();

    Eigen::MatrixR out_arr = Eigen::MatrixR::Zero(rows,cols);

    for(Integer i=0 ; i<rows;i++)
    {
        std::vector<std::string> elems;
        elems = split(arr[i], delim);
        for(Integer j=0 ; j<cols;j++)
        {
            out_arr(i,j) = std::atof(elems[j].c_str());
        }
    }

    // CHECK IF LAST LINE IS READ CORRECTLY
    bool duplicate_rows = False;
    for (Integer j=0; j<cols; ++j)
    {
        if ( out_arr(out_arr.rows()-2,j)==out_arr(out_arr.rows()-1,j) )
        {
            duplicate_rows = True;
        }
        else
        {
            duplicate_rows = False;
        }
    }
    if (duplicate_rows == True)
    {
        out_arr = out_arr.block(0,0,out_arr.rows()-1,out_arr.cols()).eval();
    }

    return out_arr;
}

void PostMeshBase::CheckMesh()
{
    /* CHECKS IF MESH IS IMPORTED CORRECTLY */

    // CHECK FOR DUPLICATED LINE COPIES IN ELEMENTS, POINTS, EDGES AND FACES
    double check_duplicated_rows;
    int flag_p = 0;
    for (int i=this->mesh_points.rows()-2; i<this->mesh_points.rows();i++)
    {
        check_duplicated_rows = (this->mesh_points.row(i) - this->mesh_points.row(i-1)).norm();
        if (std::abs(check_duplicated_rows)  < 1.0e-14)
        {
            flag_p = 1;
        }
    }
    if (flag_p == 1)
    {
        Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_points.rows()-1));
        Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_points.cols()));
        this->mesh_points = cnp::take(this->mesh_points,a_rows,a_cols);
    }

    // ELEMENTS
    int flag_e = 0;
    for (int i=this->mesh_elements.rows()-2; i<this->mesh_elements.rows();i++)
    {
        check_duplicated_rows = (this->mesh_elements.row(i) - this->mesh_elements.row(i-1)).norm();
        if (std::abs(check_duplicated_rows)  < 1.0e-14)
        {
            flag_e = 1;
        }
    }
    if (flag_e == 1)
    {
        Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_elements.rows()-1));
        Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_elements.cols()));
        this->mesh_elements = cnp::take(this->mesh_elements,a_rows,a_cols);
    }

    // EDGES
    int flag_ed = 0;
    for (Integer i=this->mesh_edges.rows()-2; i<this->mesh_edges.rows();i++)
    {
        check_duplicated_rows = (this->mesh_edges.row(i) - this->mesh_edges.row(i-1)).norm();
        if (std::abs(check_duplicated_rows)  < 1.0e-14)
        {
            flag_ed = 1;
        }
    }
    if (flag_ed == 1)
    {
        Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_edges.rows()-1));
        Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_edges.cols()));
        this->mesh_edges = cnp::take(this->mesh_edges,a_rows,a_cols);
    }

    // FACES FOR 3D
    if (this->mesh_faces.cols()!=0)
    {
        Integer flag_f = 0;
        for (Integer i=this->mesh_faces.rows()-2; i<this->mesh_faces.rows();i++)
        {
            check_duplicated_rows = (this->mesh_faces.row(i) - this->mesh_faces.row(i-1)).norm();
            if (std::abs(check_duplicated_rows)  < 1.0e-14)
            {
                flag_f = 1;
            }
        }
        if (flag_f == 1)
        {
            Eigen::MatrixI a_rows = cnp::arange(Integer(this->mesh_faces.rows()-1));
            Eigen::MatrixI a_cols = cnp::arange(Integer(this->mesh_faces.cols()));
            this->mesh_faces = cnp::take(this->mesh_faces,a_rows,a_cols);
        }
    }

    Integer maxelem = this->mesh_elements.maxCoeff();
    Integer maxpoint = this->mesh_points.rows();

    if (maxelem+1 != maxpoint)
    {
        throw std::invalid_argument("Element connectivity and nodal coordinates do not match. This can be "
                                    "caused by giving two files which do not correspond to each other");
    }

    std::cout << "All good with imported mesh. proceeding..." << std::endl;

}

void PostMeshBase::GetGeomVertices()
{
    if (!this->geometry_points.empty())
        return;

    for (TopExp_Explorer explorer(this->imported_shape,TopAbs_VERTEX); explorer.More(); explorer.Next())
    {
        // GET THE VERTICES LYING ON THE IMPORTED TOPOLOGICAL SHAPE
        TopoDS_Vertex current_vertex = TopoDS::Vertex(explorer.Current());
        gp_Pnt current_vertex_point = BRep_Tool::Pnt(current_vertex);

        this->geometry_points.push_back(current_vertex_point);
    }
}

void PostMeshBase::GetGeomEdges()
{
    //!  ITERATE OVER TopoDS_Shape AND EXTRACT ALL THE EDGES. CONVERT THE EDGES TO Geom_Curve AND
    //! GET THEIR HANDLES

    if (!this->geometry_curves.empty())
        return;

    for (TopExp_Explorer explorer(this->imported_shape,TopAbs_EDGE); explorer.More(); explorer.Next())
    {
        // GET THE EDGES
        TopoDS_Edge current_edge = TopoDS::Edge(explorer.Current());
        // CONVERT THEM TO GEOM_CURVE
        Real first, last;
        Handle_Geom_Curve curve = BRep_Tool::Curve(current_edge,first,last);
        // STORE HANDLE IN THE CONTAINER
        this->geometry_curves.push_back(curve);

        // TO GET TYPE OF THE CURVE - UNLIKE GeomAdaptor_Curve, BRepAdaptor_Curve
        // DOES NOT THROW BUT RETURNS GeomAbs_OtherCurve FOR UNKNOWN TYPE OF CURVES
        BRepAdaptor_Curve adapt_curve(current_edge);
        // STORE TYPE OF CURVE (CURVE TYPES ARE DEFINED IN OCC_INC.hpp)
        this->geometry_curves_types.push_back(adapt_curve.GetType());
    }

    // DETERMINE WHICH CURVES SET ON WHICH SURFACES
    for (TopExp_Explorer explorer(this->imported_shape,TopAbs_FACE); explorer.More(); explorer.Next())
    {
        std::vector<Handle_Geom_Curve> current_surface_curves;
        std::vector<UInteger> current_surface_curves_types;
        for (TopExp_Explorer explorer_edge(explorer.Current(),TopAbs_EDGE); explorer_edge.More(); explorer_edge.Next())
        {
            // GET THE EDGES
            TopoDS_Edge current_edge = TopoDS::Edge(explorer_edge.Current());
            // CONVERT THEM TO GEOM_CURVE
            Real first, last;
            Handle_Geom_Curve curve = BRep_Tool::Curve(current_edge,first,last);
            // STORE HANDLE IN THE CONTAINER
            current_surface_curves.push_back(curve);

            // TO GET TYPE OF THE CURVE - UNLIKE GeomAdaptor_Curve, BRepAdaptor_Curve
            // DOES NOT THROW BUT RETURNS GeomAbs_OtherCurve FOR UNKNOWN TYPE OF CURVES
            BRepAdaptor_Curve adapt_curve(current_edge);
            // STORE TYPE OF CURVE (CURVE TYPES ARE DEFINED IN OCC_INC.hpp)
            current_surface_curves_types.push_back(adapt_curve.GetType());
        }
        this->geometry_surfaces_curves.push_back(current_surface_curves);
        this->geometry_surfaces_curves_types.push_back(current_surface_curves_types);
    }
}

void PostMeshBase::GetGeomFaces()
{
    //!  ITERATE OVER TopoDS_Shape AND EXTRACT ALL THE EDGES. CONVERT THE EDGES TO Geom_Surface AND
    //! GET THEIR HANDLES

    if (!this->geometry_surfaces.empty() && !this->topo_faces.empty())
        return;

    for (TopExp_Explorer explorer(this->imported_shape,TopAbs_FACE); explorer.More(); explorer.Next())
    {

        // GET THE FACES
        TopoDS_Face current_face = TopoDS::Face(explorer.Current());
        // STORE
        this->topo_faces.push_back(current_face);
        // CONVERT THEM TO GEOM_SURFACE
        Handle_Geom_Surface surface = BRep_Tool::Surface(current_face);
        // STORE HANDLE IN THE CONTAINER
        this->geometry_surfaces.push_back(surface);

        // TO GET TYPE OF THE SURFACE. UNLIKE GeomAdaptor_Surface, BRepAdaptor_Surface
        // DOES NOT THROW BUT RETURNS GeomAbs_OtherSurface FOR UNKNOWN TYPE OF SURFACES
        BRepAdaptor_Surface adapt_surface(current_face);
        // STORE TYPE OF SURFACE (SURFACE TYPES ARE DEFINED IN OCC_INC.hpp)
        this->geometry_surfaces_types.push_back(adapt_surface.GetType());

    }
}

std::vector<Real> PostMeshBase::ObtainGeomVertices()
{
    std::vector<Real> geom_points;
    geom_points.clear();
    // PASS TO CYTHON
    for (UInteger i=0; i<this->geometry_points.size(); ++i)
    {
        geom_points.push_back(this->geometry_points[i].X());
        geom_points.push_back(this->geometry_points[i].Y());
        geom_points.push_back(this->geometry_points[i].Z());
    }

    return geom_points;
}

void PostMeshBase::ComputeProjectionCriteria()
{
    // IF NOT INITIALISED THEN COMPUTE
    assert((this->ndim==2 || this->ndim==3) && "Unknown number of dimensions");

    if (this->projection_criteria.rows()==0)
    {
        this->projection_criteria.setZero(mesh_edges.rows(),mesh_edges.cols());
        if (ndim==2)
        {
            for (Integer iedge=0; iedge<mesh_edges.rows(); iedge++)
            {
                // GET THE COORDINATES OF THE TWO END NODES
                auto x1 = this->mesh_points(this->mesh_edges(iedge,0),0);
                auto y1 = this->mesh_points(this->mesh_edges(iedge,0),1);
                auto x2 = this->mesh_points(this->mesh_edges(iedge,1),0);
                auto y2 = this->mesh_points(this->mesh_edges(iedge,1),1);

                // GET THE MIDDLE POINT OF THE EDGE
                auto x_avg = ( x1 + x2 )/2.;
                auto y_avg = ( y1 + y2 )/2.;

                auto cond = std::sqrt(x_avg*x_avg+y_avg*y_avg);

                if (cond<this->condition)
                {
                    projection_criteria(iedge)=1;
                }
            }
        }
        else if (ndim==3)
        {
            for (Integer iface=0; iface<this->mesh_faces.rows(); iface++)
            {
                // GET THE COORDINATES OF THE TWO END NODES
                auto x1 = this->mesh_points(this->mesh_faces(iface,0),0);
                auto y1 = this->mesh_points(this->mesh_faces(iface,0),1);
                auto z1 = this->mesh_points(this->mesh_faces(iface,0),2);
                auto x2 = this->mesh_points(this->mesh_faces(iface,1),0);
                auto y2 = this->mesh_points(this->mesh_faces(iface,1),1);
                auto z2 = this->mesh_points(this->mesh_faces(iface,1),2);
                auto x3 = this->mesh_points(this->mesh_faces(iface,2),0);
                auto y3 = this->mesh_points(this->mesh_faces(iface,2),1);
                auto z3 = this->mesh_points(this->mesh_faces(iface,2),2);

                auto x_avg = (x1 + x2 + x3 )/3.;
                auto y_avg = (y1 + y2 + y3 )/3.;
                auto z_avg = (z1 + z2 + z3 )/3.;

                auto cond = std::sqrt(x_avg*x_avg+y_avg*y_avg+z_avg*z_avg);

                if (cond<this->condition)
                {
                    projection_criteria(iface)=1;
                }
            }
        }
    }
}

DirichletData PostMeshBase::GetDirichletData()
{
    // OBTAIN DIRICHLET DATA
    DirichletData Dirichlet_data;
    // CONVERT FROM EIGEN TO STL VECTOR
    std::vector<Integer> nodes_Dirichlet_data_stl;
    nodes_Dirichlet_data_stl.assign(this->nodes_dir.data(),this->nodes_dir.data()+this->nodes_dir.rows());
    // FIND UNIQUE VALUES OF DIRICHLET DATA
    std::vector<Integer> idx;
    std::tie(std::ignore,idx) = cnp::unique(nodes_Dirichlet_data_stl,true);

    Dirichlet_data.nodes_dir_out_stl.resize(idx.size());
    Dirichlet_data.displacement_BC_stl.resize(this->ndim*idx.size());
    Dirichlet_data.nodes_dir_size = idx.size();

    for (UInteger i=0; i<idx.size(); ++i)
    {
        Dirichlet_data.nodes_dir_out_stl[i] = nodes_Dirichlet_data_stl[idx[i]];
        for (UInteger j=0; j<this->ndim; ++j)
        {
            Dirichlet_data.displacement_BC_stl[this->ndim*i+j] = this->displacements_BC(idx[i],j);
        }
    }

    return Dirichlet_data;
}


text:
layout: home
---
# About


text:
Update to Faker at http://faker.codeplex.com/ to make it thread safe.

I based this thread-safe version on the information in this article:
http://blogs.msdn.com/b/pfxteam/archive/2009/02/19/9434171.aspx

## Version History
1.1 - update to make use of Random thread safe
1.0 - all work done by sasabrankovic


text:
{{$title}}

				{{LL('cms::button.back', CMSLANG)}}

			<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown">

			</button>

						{{LL('cms::form.page_edit_elements', CMSLANG)}}

				@if (!is_null($elements))
					@forelse ($elements as $element)
						@if($element_id != $element->id)

							id))}}">
								<i class="icon-star<?php if($element->is_valid == 0) echo '-empty'; ?>">
								{{strtoupper($element->zone)}}
								{{$element->label}}

						@endif
					@empty

{{LL('cms::alert.element_empty', CMSLANG)}}

					@endforelse
				@else

{{LL('cms::alert.element_empty', CMSLANG)}}

				@endif

{{LL('cms::form.element_settings', CMSLANG)}}

					@if(EDITOR == 'ckeditor')

{{LL('cms::form.element_content', CMSLANG)}}

					@endif
					@if(EDITOR == 'markitup')

{{LL('cms::form.element_content', CMSLANG)}}

					@endif

{{LL('cms::button.page_media', CMSLANG)}}

{{LL('cms::form.element_stack', CMSLANG)}}

						{{Form::open(action('cms::ajax_page@save_element_settings'), 'POST', array('class' => 'form-vertical', 'id' => 'form_element_settings')) . "\n"}}
							{{Form::hidden('page_id', $page_id, array('class' => 'page_id')) . "\n"}}
							{{Form::hidden('element_id', $element_id, array('class' => 'element_id')) . "\n"}}
							<fieldset>
								<legend>{{$page_name}} / {{LL('cms::form.element_settings_legend', CMSLANG)}}</legend>

											{{Form::label('page_lang', LL('cms::form.page_lang', CMSLANG), array('class' => 'control-label')) . "\n"}}

												{{HTML::span(CONF('cms::settings.langs', LANG), array('class' => 'label label-warning')) . "\n"}}

											{{Form::label('element_label', LL('cms::form.element_label', CMSLANG), array('class' => 'control-label')) . "\n"}}

												{{Form::text('element_label', $element_label, array('class' => 'span3', 'id' => 'element_label'))}}

											{{Form::label('element_name', LL('cms::form.element_name', CMSLANG), array('class' => 'control-label')) . "\n"}}

													#
													{{Form::text('element_name', $element_name, array('class' => 'span2', 'id' => 'element_name'))}}

											{{Form::label('element_zone', LL('cms::form.element_zone', CMSLANG), array('class' => 'control-label')) . "\n"}}

												{{Form::select('element_zone', $element_zones, $element_zone_selected, array('id' => 'element_zone', 'class' => 'span3')) . "\n"}}

													{{Form::checkbox('is_valid', 1, $element_is_valid, array('id' => 'element_is_valid'))}}
													{{LL('cms::form.element_is_valid', CMSLANG)}}

											{{ Config::get('cms::theme.header.'.$page_header_selected) }}

											{{ $page_layout_preview }}

											{{ Config::get('cms::theme.footer.'.$page_footer_selected) }}

										{{LL('cms::button.save_continue', CMSLANG)}}

										{{LL('cms::button.save_exit', CMSLANG)}}

										{{LL('cms::button.page_exit', CMSLANG)}}

									@if(!empty($element_id))

										{{LL('cms::button.element_clone', CMSLANG)}}

									@endif

							</fieldset>
						{{Form::close()}}

					@if(EDITOR == 'ckeditor')

						{{Form::open(action('cms::ajax_page@save_element_text'), 'POST', array('class' => 'form-vertical', 'id' => 'form_ckeditor')) . "\n"}}
							{{Form::hidden('page_id', $page_id, array('class' => 'page_id')) . "\n"}}
							{{Form::hidden('element_id', $element_id, array('class' => 'element_id')) . "\n"}}
							<fieldset>
								<legend>{{$page_name}} / {{$element_label}} / {{LL('cms::form.element_ckeditor_legend', CMSLANG)}}</legend>

									{{Form::label('page_lang', LL('cms::form.page_lang', CMSLANG), array('class' => 'control-label')) . "\n"}}

										{{HTML::span(CONF('cms::settings.langs', LANG), array('class' => 'label label-warning')) . "\n"}}

									{{Form::label('element_text', LL('cms::form.element_text', CMSLANG), array('class' => 'control-label')) . "\n"}}

											{{LL('cms::button.sample_pick', CMSLANG)}}

											{{LL('cms::button.media_pick', CMSLANG)}}

											{{LL('cms::button.marker_pick', CMSLANG)}}

										{{Form::textarea('element_text', $element_text, array('class' => 'span6 editorck', 'id' => 'element_text', 'rows' => 8))}}

										{{LL('cms::button.save_continue', CMSLANG)}}

									@if(!empty($element_id))

										{{LL('cms::button.element_clone', CMSLANG)}}

									@endif

							</fieldset>
						{{Form::close()}}

					@endif

					@if(EDITOR == 'markitup')

						{{Form::open(action('cms::ajax_page@save_element_text'), 'POST', array('class' => 'form-vertical', 'id' => 'form_markitup')) . "\n"}}
							{{Form::hidden('page_id', $page_id, array('class' => 'page_id')) . "\n"}}
							{{Form::hidden('element_id', $element_id, array('class' => 'element_id')) . "\n"}}
							<fieldset>
								<legend>{{$page_name}} / {{$element_label}} / {{LL('cms::form.element_markitup_legend', CMSLANG)}}</legend>

									{{Form::label('page_lang', LL('cms::form.page_lang', CMSLANG), array('class' => 'control-label')) . "\n"}}

										{{HTML::span(CONF('cms::settings.langs', LANG), array('class' => 'label label-warning')) . "\n"}}

									{{Form::label('element_text', LL('cms::form.element_text', CMSLANG), array('class' => 'control-label')) . "\n"}}

											{{LL('cms::button.sample_pick', CMSLANG)}}

											{{LL('cms::button.media_pick', CMSLANG)}}

											{{LL('cms::button.marker_pick', CMSLANG)}}

										{{Form::textarea('element_text', $element_text, array('class' => 'html', 'id' => 'markitup', 'rows' => 8))}}

										{{LL('cms::button.save_continue', CMSLANG)}}

									@if(!empty($element_id))

										{{LL('cms::button.element_clone', CMSLANG)}}

									@endif

							</fieldset>
						{{Form::close()}}

					@endif

						<legend>{{$page_name}} / {{LL('cms::form.page_legend_media', CMSLANG)}}</legend>

									{{LL('cms::alert.upload_allowed', CMSLANG, array('format' => Config::get('cms::settings.mimes'), 'size' => Config::get('cms::settings.max_size')))}}

{{LL('cms::alert.upload_unavailable', CMSLANG)}}

						@if(!$role_fail)

									{{LL('cms::button.page_media_add', CMSLANG)}}

									{{LL('cms::button.page_media_upload', CMSLANG)}}

						@endif

						<legend class="space">{{LL('cms::form.page_legend_media_available', CMSLANG)}}</legend>

									@forelse ($media as $file)

										path}}" class="thumbnail fancy" rel="tooltip" data-original-title="{{$file->name}}">
											@if (MEDIA_TYPE($file->ext) == 'img')
											thumb}}" width="100" heigth="100" alt="">
											@else
											ext}}_ico.png" width="100" heigth="100" alt="">
											@endif

									@empty

{{LL('cms::alert.list_empty', CMSLANG)}}

									@endforelse

						<legend>{{$page_name}} / {{LL('cms::form.element_legend_stack', CMSLANG)}}</legend>

						@if(!$role_fail)
							@forelse ($elements as $element)
								@if($element->zone == $element_zone_selected)

id}}" data-zone="{{$element->zone}}">

											{{$element->label}}

								@endif
							@empty

									{{LL('cms::alert.list_empty', CMSLANG)}}

							@endforelse
						@else

								{{LL('cms::alert.list_empty', CMSLANG)}}

						@endif

		<button class="close" data-dismiss="modal">×</button>

{{LL('cms::form.modal_title_media', CMSLANG)}}

			<col width="12%">
			<col width="68%">
			<col width="20%">

		{{LL('cms::button.close', CMSLANG)}}

		<button class="close" data-dismiss="modal">×</button>

{{LL('cms::form.modal_title_marker', CMSLANG)}}

		{{View::make('cms::interface.partials.markers')}}

		{{LL('cms::button.close', CMSLANG)}}

		<button class="close" data-dismiss="modal">×</button>

{{LL('cms::form.modal_title_sample', CMSLANG)}}

		{{View::make('cms::interface.partials.samples')}}

		{{LL('cms::button.close', CMSLANG)}}

	{{Form::open(action('cms::page@clone_element'), 'POST')}}
	{{Form::hidden('element_id', $element_id)}}
	{{Form::hidden('page_id', $page_id)}}

		<button class="close" data-dismiss="modal">×</button>

{{LL('cms::form.modal_title_clone_element', CMSLANG)}}

		@if(!$role_fail)

{{LL('cms::form.modal_descr_clone_element', CMSLANG)}}

{{Form::select('newpage_id', CmsPage::select_top_slug(LANG, 0, false), null, array('class' => 'span6'))}}

			{{Form::checkbox('to_clone', 1, null)}}
			{{LL('cms::form.element_to_clone', CMSLANG)}}

		@else

{{LL('cms::ajax_resp.ownership_error', CMSLANG)}}

		@endif

		{{LL('cms::button.close', CMSLANG)}}
		@if(!$role_fail)
		{{Form::submit(LL('cms::button.clone', CMSLANG), array('class' => 'btn btn-danger'))}}
		@endif

	{{Form::close()}}


text:
@interface TLEmoji : TLBaseDataModel

@property (nonatomic, assign) TLEmojiType type;

@property (nonatomic, strong) NSString *groupID;

@property (nonatomic, strong) NSString *emojiID;

@property (nonatomic, strong) NSString *emojiName;

@property (nonatomic, strong) NSString *emojiPath;

@property (nonatomic, strong) NSString *emojiURL;

@property (nonatomic, assign) CGFloat size;

@end


text:
"""L{twisted.manhole} L{PB<twisted.spread.pb>} service implementation.
"""

# twisted imports
from twisted import copyright
from twisted.spread import pb
from twisted.python import log, failure
from twisted.cred import portal
from twisted.application import service
from zope.interface import implements, Interface

# sibling imports
import explorer

# system imports
from cStringIO import StringIO

import string
import sys
import traceback
import types

class FakeStdIO:
    def __init__(self, type_, list):
        self.type = type_
        self.list = list

    def write(self, text):
        log.msg("%s: %s" % (self.type, string.strip(str(text))))
        self.list.append((self.type, text))

    def flush(self):
        pass

    def consolidate(self):
        """Concatenate adjacent messages of same type into one.

        Greatly cuts down on the number of elements, increasing
        network transport friendliness considerably.
        """
        if not self.list:
            return

        inlist = self.list
        outlist = []
        last_type = inlist[0]
        block_begin = 0
        for i in xrange(1, len(self.list)):
            (mtype, message) = inlist[i]
            if mtype == last_type:
                continue
            else:
                if (i - block_begin) == 1:
                    outlist.append(inlist[block_begin])
                else:
                    messages = map(lambda l: l[1],
                                   inlist[block_begin:i])
                    message = string.join(messages, '')
                    outlist.append((last_type, message))
                last_type = mtype
                block_begin = i

class IManholeClient(Interface):
    def console(list_of_messages):
        """Takes a list of (type, message) pairs to display.

        Types include:
            - \"stdout\" -- string sent to sys.stdout

            - \"stderr\" -- string sent to sys.stderr

            - \"result\" -- string repr of the resulting value
                 of the expression

            - \"exception\" -- a L{failure.Failure}
        """

    def receiveExplorer(xplorer):
        """Receives an explorer.Explorer
        """

    def listCapabilities():
        """List what manholey things I am capable of doing.

        i.e. C{\"Explorer\"}, C{\"Failure\"}
        """

def runInConsole(command, console, globalNS=None, localNS=None,
                 filename=None, args=None, kw=None, unsafeTracebacks=False):
    """Run this, directing all output to the specified console.

    If command is callable, it will be called with the args and keywords
    provided.  Otherwise, command will be compiled and eval'd.
    (Wouldn't you like a macro?)

    Returns the command's return value.

    The console is called with a list of (type, message) pairs for
    display, see L{IManholeClient.console}.
    """
    output = []
    fakeout = FakeStdIO("stdout", output)
    fakeerr = FakeStdIO("stderr", output)
    errfile = FakeStdIO("exception", output)
    code = None
    val = None
    if filename is None:
        filename = str(console)
    if args is None:
        args = ()
    if kw is None:
        kw = {}
    if localNS is None:
        localNS = globalNS
    if (globalNS is None) and (not callable(command)):
        raise ValueError("Need a namespace to evaluate the command in.")

    try:
        out = sys.stdout
        err = sys.stderr
        sys.stdout = fakeout
        sys.stderr = fakeerr
        try:
            if callable(command):
                val = apply(command, args, kw)
            else:
                try:
                    code = compile(command, filename, 'eval')
                except:
                    code = compile(command, filename, 'single')

                if code:
                    val = eval(code, globalNS, localNS)
        finally:
            sys.stdout = out
            sys.stderr = err
    except:
        (eType, eVal, tb) = sys.exc_info()
        fail = failure.Failure(eVal, eType, tb)
        del tb
        # In CVS reversion 1.35, there was some code here to fill in the
        # source lines in the traceback for frames in the local command
        # buffer.  But I can't figure out when that's triggered, so it's
        # going away in the conversion to Failure, until you bring it back.
        errfile.write(pb.failure2Copyable(fail, unsafeTracebacks))

    if console:
        fakeout.consolidate()
        console(output)

    return val

def _failureOldStyle(fail):
    """Pre-Failure manhole representation of exceptions.

    For compatibility with manhole clients without the \"Failure\"
    capability.

    A dictionary with two members:
        - \'traceback\' -- traceback.extract_tb output; a list of tuples
             (filename, line number, function name, text) suitable for
             feeding to traceback.format_list.

        - \'exception\' -- a list of one or more strings, each
             ending in a newline. (traceback.format_exception_only output)
    """
    import linecache
    tb = []
    for f in fail.frames:
        # (filename, line number, function name, text)
        tb.append((f[1], f[2], f[0], linecache.getline(f[1], f[2])))

    return {
        'traceback': tb,
        'exception': traceback.format_exception_only(fail.type, fail.value)
        }

# Capabilities clients are likely to have before they knew how to answer a
# "listCapabilities" query.
_defaultCapabilities = {
    "Explorer": 'Set'
    }

class Perspective(pb.Avatar):
    lastDeferred = 0
    def __init__(self, service):
        self.localNamespace = {
            "service": service,
            "avatar": self,
            "_": None,
            }
        self.clients = {}
        self.service = service

    def __getstate__(self):
        state = self.__dict__.copy()
        state['clients'] = {}
        if state['localNamespace'].has_key("__builtins__"):
            del state['localNamespace']['__builtins__']
        return state

    def attached(self, client, identity):
        """A client has attached -- welcome them and add them to the list.
        """
        self.clients[client] = identity

        host = ':'.join(map(str, client.broker.transport.getHost()[1:]))

        msg = self.service.welcomeMessage % {
            'you': getattr(identity, 'name', str(identity)),
            'host': host,
            'longversion': copyright.longversion,
            }

        client.callRemote('console', [("stdout", msg)])

        client.capabilities = _defaultCapabilities
        client.callRemote('listCapabilities').addCallbacks(
            self._cbClientCapable, self._ebClientCapable,
            callbackArgs=(client,),errbackArgs=(client,))

    def detached(self, client, identity):
        try:
            del self.clients[client]
        except KeyError:
            pass

    def runInConsole(self, command, *args, **kw):
        """Convience method to \"runInConsole with my stuff\".
        """
        return runInConsole(command,
                            self.console,
                            self.service.namespace,
                            self.localNamespace,
                            str(self.service),
                            args=args,
                            kw=kw,
                            unsafeTracebacks=self.service.unsafeTracebacks)

    ### Methods for communicating to my clients.

    def console(self, message):
        """Pass a message to my clients' console.
        """
        clients = self.clients.keys()
        origMessage = message
        compatMessage = None
        for client in clients:
            try:
                if not client.capabilities.has_key("Failure"):
                    if compatMessage is None:
                        compatMessage = origMessage[:]
                        for i in xrange(len(message)):
                            if ((message[i][0] == "exception") and
                                isinstance(message[i][1], failure.Failure)):
                                compatMessage[i] = (
                                    message[i][0],
                                    _failureOldStyle(message[i][1]))
                    client.callRemote('console', compatMessage)
                else:
                    client.callRemote('console', message)
            except pb.ProtocolError:
                # Stale broker.
                self.detached(client, None)

    def receiveExplorer(self, objectLink):
        """Pass an Explorer on to my clients.
        """
        clients = self.clients.keys()
        for client in clients:
            try:
                client.callRemote('receiveExplorer', objectLink)
            except pb.ProtocolError:
                # Stale broker.
                self.detached(client, None)

    def _cbResult(self, val, dnum):
        self.console([('result', "Deferred #%s Result: %r\n" %(dnum, val))])
        return val

    def _cbClientCapable(self, capabilities, client):
        log.msg("client %x has %s" % (id(client), capabilities))
        client.capabilities = capabilities

    def _ebClientCapable(self, reason, client):
        reason.trap(AttributeError)
        log.msg("Couldn't get capabilities from %s, assuming defaults." %
                (client,))

    ### perspective_ methods, commands used by the client.

    def perspective_do(self, expr):
        """Evaluate the given expression, with output to the console.

        The result is stored in the local variable '_', and its repr()
        string is sent to the console as a \"result\" message.
        """
        log.msg(">>> %s" % expr)
        val = self.runInConsole(expr)
        if val is not None:
            self.localNamespace["_"] = val
            from twisted.internet.defer import Deferred
            # TODO: client support for Deferred.
            if isinstance(val, Deferred):
                self.lastDeferred += 1
                self.console([('result', "Waiting for Deferred #%s...\n" % self.lastDeferred)])
                val.addBoth(self._cbResult, self.lastDeferred)
            else:
                self.console([("result", repr(val) + '\n')])
        log.msg("<<<")

    def perspective_explore(self, identifier):
        """Browse the object obtained by evaluating the identifier.

        The resulting ObjectLink is passed back through the client's
        receiveBrowserObject method.
        """
        object = self.runInConsole(identifier)
        if object:
            expl = explorer.explorerPool.getExplorer(object, identifier)
            self.receiveExplorer(expl)

    def perspective_watch(self, identifier):
        """Watch the object obtained by evaluating the identifier.

        Whenever I think this object might have changed, I will pass
        an ObjectLink of it back to the client's receiveBrowserObject
        method.
        """
        raise NotImplementedError
        object = self.runInConsole(identifier)
        if object:
            # Return an ObjectLink of this right away, before the watch.
            oLink = self.runInConsole(self.browser.browseObject,
                                      object, identifier)
            self.receiveExplorer(oLink)

            self.runInConsole(self.browser.watchObject,
                              object, identifier,
                              self.receiveExplorer)

class Realm:

    implements(portal.IRealm)

    def __init__(self, service):
        self.service = service
        self._cache = {}

    def requestAvatar(self, avatarId, mind, *interfaces):
        if pb.IPerspective not in interfaces:
            raise NotImplementedError("no interface")
        if avatarId in self._cache:
            p = self._cache[avatarId]
        else:
            p = Perspective(self.service)
        p.attached(mind, avatarId)
        def detached():
            p.detached(mind, avatarId)
        return (pb.IPerspective, p, detached)

class Service(service.Service):

    welcomeMessage = (
        "\nHello %(you)s, welcome to Manhole "
        "on %(host)s.\n"
        "%(longversion)s.\n\n")

    def __init__(self, unsafeTracebacks=False, namespace=None):
        self.unsafeTracebacks = unsafeTracebacks
        self.namespace = {
            '__name__': '__manhole%x__' % (id(self),),
            'sys': sys
            }
        if namespace:
            self.namespace.update(namespace)

    def __getstate__(self):
        """This returns the persistent state of this shell factory.
        """
        # TODO -- refactor this and twisted.reality.author.Author to
        # use common functionality (perhaps the 'code' module?)
        dict = self.__dict__.copy()
        ns = dict['namespace'].copy()
        dict['namespace'] = ns
        if ns.has_key('__builtins__'):
            del ns['__builtins__']
        return dict


text:
namespace ios {

class TestChromeBrowserProvider;

// Initializes various objects needed to run unit tests that use ios::
// objects. Currently this includes setting up the chrome browser provider as
// a |TestChromeBrowserProvider|.
class TestChromeProviderInitializer {
 public:
  TestChromeProviderInitializer();
  virtual ~TestChromeProviderInitializer();

 private:
  std::unique_ptr<TestChromeBrowserProvider> chrome_browser_provider_;

  DISALLOW_COPY_AND_ASSIGN(TestChromeProviderInitializer);
};

}  // namespace ios

#endif  // IOS_PUBLIC_PROVIDER_CHROME_BROWSER_TEST_CHROME_PROVIDER_INITIALIZER_H_


text:
package ca.uhn.fhir.jpa.dao.r5;

import ca.uhn.fhir.jpa.dao.BaseHapiFhirSystemDao;
import ca.uhn.fhir.jpa.dao.FhirResourceDaoMessageHeaderDstu2;
import ca.uhn.fhir.jpa.model.entity.TagDefinition;
import ca.uhn.fhir.rest.api.RestOperationTypeEnum;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.interceptor.IServerInterceptor.ActionRequestDetails;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.r5.model.Bundle;
import org.hl7.fhir.r5.model.Meta;

import javax.persistence.TypedQuery;
import java.util.Collection;
import java.util.List;

public class FhirSystemDaoR5 extends BaseHapiFhirSystemDao<Bundle, Meta> {

	private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirSystemDaoR5.class);

	@Override
	public Meta metaGetOperation(RequestDetails theRequestDetails) {
		// Notify interceptors
		ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails);
		notifyInterceptors(RestOperationTypeEnum.META, requestDetails);

		String sql = "SELECT d FROM TagDefinition d WHERE d.myId IN (SELECT DISTINCT t.myTagId FROM ResourceTag t)";
		TypedQuery<TagDefinition> q = myEntityManager.createQuery(sql, TagDefinition.class);
		List<TagDefinition> tagDefinitions = q.getResultList();

		return toMeta(tagDefinitions);
	}

	@Override
	public IBaseBundle processMessage(RequestDetails theRequestDetails, IBaseBundle theMessage) {
		return FhirResourceDaoMessageHeaderDstu2.throwProcessMessageNotImplemented();
	}

	protected Meta toMeta(Collection<TagDefinition> tagDefinitions) {
		Meta retVal = new Meta();
		for (TagDefinition next : tagDefinitions) {
			switch (next.getTagType()) {
				case PROFILE:
					retVal.addProfile(next.getCode());
					break;
				case SECURITY_LABEL:
					retVal.addSecurity().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay());
					break;
				case TAG:
					retVal.addTag().setSystem(next.getSystem()).setCode(next.getCode()).setDisplay(next.getDisplay());
					break;
			}
		}
		return retVal;
	}

}


text:
'use strict';

angular.module('supermarketApp')
    .controller('LoginController', function ($scope, $http, $window, $state, auth) {
        $scope.login = function () {
            $http({
                method: 'POST',
                url: '/login',
                data: {
                    user: {
                        userName: $scope.user.userName,
                        password: CryptoJS.MD5($scope.user.password).toString()
                    }
                }
            }).then(function (response) {
                var user = response.data;
                auth.isLoggedIn = true;
                auth.isAdmin = user.isAdmin;
                $state.go('home');
            }, function (response) {
                if (response.status === 401) {
                    alert('Invalid username/password.');
                }
            });
        };
    });


text:
layout: default
title: CHA Dev Events
---

            CHA Dev Events

                Sorry, you need JavaScript to view this page


text:
const atImport = require("postcss-import");
const autoprefixer = require("autoprefixer");
const cssnano = require("cssnano");
const importUrl = require("postcss-import-url");
const mqPacker = require("css-mqpacker");
const purgecss = require("@fullhuman/postcss-purgecss");
const sass = require("postcss-node-sass");

const prodPlugins = [
  purgecss({
    content: ["./**/templates/**/*.html", "./manager/static/js/src/**/*.js"],
    whitelistPatterns: [
      // Icon classes specified in Python code and purged without this whitelisting
      /^ri-file-3-line$/,
      /^ri-file-code-line$/,
      /^ri-file-excel-line$/,
      /^ri-file-line$/,
      /^ri-file-pdf-line$/,
      /^ri-file-word-line$/,
      /^ri-image-line$/,
      /^ri-markdown-line$/,
      /^ri-twitter-line$/
    ]
  }),
  cssnano({
    preset: ["default", { discardUnused: true, mergeIdents: true }],
  }),
];

module.exports = {
  syntax: "postcss-scss",
  plugins: [
    sass({}),
    importUrl({
      modernBrowser: true,
      resolveUrls: true,
    }),
    atImport(),
    autoprefixer,
    mqPacker(),
    ...(process.env.NODE_ENV === "production" ? prodPlugins : []),
  ],
};


text:
//-----------------------------------------------
//
//	This file is part of the Siv3D Engine.
//
//	Copyright (c) 2008-2022 Ryo Suzuki
//	Copyright (c) 2016-2022 OpenSiv3D Project
//
//	Licensed under the MIT License.
//
//-----------------------------------------------

# pragma once
# include "Common.hpp"
# include "Array.hpp"
# include "String.hpp"
# include "Optional.hpp"
# include "2DShapes.hpp"

namespace s3d
{
	/// @brief メニューバー上のアイテムのインデックス
	struct MenuBarItemIndex
	{
		/// @brief メニューのインデックス
		size_t menuIndex = 0;

		/// @brief アイテムのインデックス
		size_t itemIndex = 0;

		friend constexpr bool operator ==(const MenuBarItemIndex& lhs, const MenuBarItemIndex& rhs) noexcept
		{
			return ((lhs.menuIndex == rhs.menuIndex) && (lhs.itemIndex == rhs.itemIndex));
		}

		friend constexpr bool operator !=(const MenuBarItemIndex& lhs, const MenuBarItemIndex& rhs) noexcept
		{
			return ((lhs.menuIndex != rhs.menuIndex) || (lhs.itemIndex != rhs.itemIndex));
		}
	};

	/// @brief メニューバー
	class SimpleMenuBar
	{
	public:

		/// @brief メニューバーの高さ(ピクセル)
		static constexpr int32 MenuBarHeight = 30;

		/// @brief カラーパレット
		struct ColorPalette
		{
			/// @brief メニューバーの背景色
			ColorF menuBarColor{ 0.88 };

			/// @brief アクティブなメニューの背景色
			ColorF activeMenuColor{ 0.8 };

			/// @brief メニューのテキストの色
			ColorF menuTextColor{ 0.11 };

			/// @brief メニューアイテムの背景色
			ColorF itemBoxColor{ 0.99 };

			/// @brief マウスオーバーされているメニューアイテムの背景色
			ColorF itemMouseoverColor{ 0.88 };

			/// @brief メニューアイテムのテキストの色
			ColorF itemTextColor{ 0.11 };

			/// @brief マウスオーバーされているメニューアイテムのテキストの色
			ColorF itemMouseoverTextColor{ 0.11 };

			/// @brief 無効化されているメニューアイテムのテキストの色
			ColorF itemDisabledTextColor{ 0.8 };

			/// @brief メニューアイテムの影の色
			ColorF itemRectShadowColor{ 0.0, 0.5 };
		};

		SimpleMenuBar() = default;

		/// @brief メニューバーを構築します。
		/// @param menus メニューアイテム
		explicit SimpleMenuBar(const Array<std::pair<String, Array<String>>>& menus);

		/// @brief メニューバーを更新します。
		/// @return メニューアイテムが選択され場合、そのアイテムのインデックス。それ以外の場合は none
		Optional<MenuBarItemIndex> update();

		/// @brief メニューバーを描画します。
		void draw() const;

		/// @brief アイテムの有効無効を切り替えます。
		/// @param menuIndex メニューインデックス
		/// @param itemIndex アイテムインデックス
		/// @param enbaled 有効にする場合 true, 無効にする場合 false
		/// @return *this
		SimpleMenuBar& setItemEnabled(size_t menuIndex, size_t itemIndex, bool enbaled);

		/// @brief アイテムの有効無効を切り替えます。
		/// @param itemIndex アイテムのインデックス
		/// @param enbaled 有効にする場合 true, 無効にする場合 false
		/// @return *this
		SimpleMenuBar& setItemEnabled(const MenuBarItemIndex& itemIndex, bool enbaled);

		/// @brief アイテムの有効無効を取得します。
		/// @param menuIndex メニューインデックス
		/// @param itemIndex アイテムインデックス
		/// @return 有効である場合 true, 無効である場合 false
		bool getItemEnabled(size_t menuIndex, size_t itemIndex) const;

		/// @brief アイテムの有効無効を取得します。
		/// @param itemIndex イテムのインデックス
		/// @return 有効である場合 true, 無効である場合 false
		bool getItemEnabled(const MenuBarItemIndex& itemIndex) const;

		/// @brief カラーパレットを変更します。
		/// @param palette 新しいカラーパレット
		/// @return *this
		SimpleMenuBar& setColorPalette(const ColorPalette& palette) noexcept;

	private:

		static constexpr int32 MenuPadding = 14;

		static constexpr int32 FontSize = 16;

		static constexpr int32 ItemPaddingLeft = 24;

		static constexpr int32 ItemPaddingRight = (ItemPaddingLeft + 4);

		static constexpr int32 ItemPaddingY = 5;

		static constexpr int32 ItemHeight = 34;

		struct Menu
		{
			String name;

			Rect menuRect;

			Rect itemBoxRect;

			Array<String> items;

			Array<bool> itemsEnabled;
		};

		Array<Menu> m_menus;

		Optional<size_t> m_mouseOverMenu;

		Optional<size_t> m_openMenu;

		Optional<size_t> m_mouseOverItem;

		Rect m_rect = Rect::Empty();

		ColorPalette m_palette;

		void reset() noexcept;
	};
}


text:
import * as React from "react";
import {connect} from "react-redux";
import {AppState} from "redux/reducers/AppReducers";
import {ComponentBase} from 'components/ComponentBase';
import {TextAdventureChoice} from 'components/text-adventures/TextAdventureChoice';
import * as adventureStyles from 'components/css/text-adventure.scss';
import {Introduction} from 'model/TextAdventureModel';

interface TextAdventureIntroductionOwnProps {
    introduction: Introduction;
}

interface TextAdventureIntroductionStateProps {
}

const mapStateToProps = (state: AppState, ownProps: TextAdventureIntroductionOwnProps): TextAdventureIntroductionStateProps => {
    return {}
};

interface TextAdventureIntroductionDispatchProps {
}

const mapDispatchToProps = (dispatch, ownProps: TextAdventureIntroductionOwnProps): TextAdventureIntroductionDispatchProps => {
    return {};
};

class TextAdventureIntroductionComponent extends ComponentBase<TextAdventureIntroductionOwnProps, TextAdventureIntroductionStateProps, TextAdventureIntroductionDispatchProps, {}> {
    render() {
        return (

{this.props.introduction.introductionText}

{this.props.introduction.choices.map((choice, key) => <TextAdventureChoice key={key} choice={choice} />)}

        )
    }
}

export const TextAdventureIntroduction = connect<TextAdventureIntroductionStateProps, TextAdventureIntroductionDispatchProps, TextAdventureIntroductionOwnProps>(
    mapStateToProps,
    mapDispatchToProps
)(TextAdventureIntroductionComponent);


text:
class Magneto {
private:
	I2CRead<6> magnetoRead;
	I2CWrite<1> magnetoMeasurementEnableWrite;

	unsigned magnetoPhase;
	Vector<3> magnetoScale;
	Vector<3> magnetoOffset;
public:
	Magneto();
	void init();
	void read();
	bool hasNewData(){ return magnetoPhase == 1; }
	Vector<3> magneto;
};

#endif // MAGNETO_H


text:
@interface HDetailController : UIViewController

@property(nonatomic,strong)NSString * ID;
@end