text:
;(function(namespace) {
  'use strict';

  /**
   * Represents an API that emits events and supports
   * registration of subscribers, or, more generally: an
   * interface between two software components that you
   * want loosely-coupled.
   * An instance of this constructor function should
   * form the prototype of each sub-type.
   * @constructor
   */
  var api = {};

  /**
   * An 'enumeration' (i.e. a simple object map) of the
   * events that this API can raise.
   * This approach keeps your code DRY.
   */
  api.events = {};

  /**
   * Objects within the software component associated with this
   * API should call this method to notify subscribers of the specified event.
   * @param {Number} event - A member of the events enumeration.
   */
  api.emit = function(event) {
    var args;

    if (event == null) {
      throw 'event not supplied.'
    }

    args = Array.prototype.slice.call(arguments, 1); //Skip the event name

    if (!this.subscribers) {
      return; // Subscribers not initialized.
    }

    this.subscribers[event].forEach(function(s) {
      s.cb.apply(this, args);
    });
  };

  /**
   * Clients should register for notification of events
   * raised by this API using this method.
   * Note: there is no corresponding 'off' method. To
   * stop communication between two components, use
   * the `unload` method on the connector.
   * @param {Number/String} event - A member of the events enumeration.
   */
  api.on = function(event) {
    if (event == null) {
      throw 'event not supplied.';
    }

    // subscriber: The api instance subscribing to the event.
    // methodName: The name of the method on `subscriber` that will be invoked when an event is raised.
    return {
      notify: function(subscriber) {
        if (subscriber == null) {
          throw 'subscriber not supplied.';
        }

        return {
          byCalling: function(methodName) {
            if (methodName == null || methodName === '') {
              throw 'methodName not supplied.';
            }

            configureOn.call(this, event, subscriber, methodName);
          }.bind(this)
        };
      }.bind(this)
    };
  };

  function configureOn(event, subscriber, methodName) {
    var cb = subscriber[methodName];

    if (cb === undefined) {
      throw 'methodName not present on subscriber.';
    }
    if (typeof cb !== 'function') {
      throw 'methodName not a function.';
    }

    this.subscribers = this.subscribers || {};
    this.subscribers[event] = this.subscribers[event] || [];

    if (this.subscribers[event]
      .some(function(el) {
        return el.cb === cb;
      })) {
      return; // Duplicate subscription.
    }

    this.subscribers[event].push({
      name: subscriber.name,
      cb: cb
    });
  }

  namespace.api = api;
}(namespace));


text:
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// clang-format off
// #import 'chrome://os-settings/chromeos/os_settings.js';
// #import 'chrome://os-settings/strings.m.js';

// #import {flush, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';
// #import {assertTrue} from '../../../chai_assert.js';
// #import {eventToPromise} from 'chrome://test/test_util.js';
// #import {FakeBluetoothConfig} from 'chrome://test/cr_components/chromeos/bluetooth/fake_bluetooth_config.js';
// #import {setBluetoothConfigForTesting} from 'chrome://resources/cr_components/chromeos/bluetooth/cros_bluetooth_config.js';
// clang-format on

suite('OsBluetoothPairingDialogTest', function() {
  /** @type {?SettingsBluetoothPairingDialogElement} */
  let bluetoothPairingDialog;

  /** @type {!FakeBluetoothConfig} */
  let bluetoothConfig;

  /** @type {!chromeos.bluetoothConfig.mojom} */
  let mojom;

  setup(function() {
    mojom = chromeos.bluetoothConfig.mojom;

    bluetoothConfig = new FakeBluetoothConfig();
    setBluetoothConfigForTesting(bluetoothConfig);

    bluetoothPairingDialog =
        document.createElement('os-settings-bluetooth-pairing-dialog');
    document.body.appendChild(bluetoothPairingDialog);
    Polymer.dom.flush();
  });

  test('Finished event is fired on close', async function() {
    const pairingDialog =
        bluetoothPairingDialog.shadowRoot.querySelector('bluetooth-pairing-ui');
    assertTrue(!!pairingDialog);

    const closeBluetoothPairingUiPromise =
        test_util.eventToPromise('close', bluetoothPairingDialog);

    pairingDialog.dispatchEvent(new CustomEvent('finished'));

    await closeBluetoothPairingUiPromise;
  });
});

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:paddingLeft="@dimen/activity_horizontal_margin"
                android:paddingRight="@dimen/activity_horizontal_margin"
                android:paddingTop="@dimen/activity_vertical_margin"
                android:paddingBottom="@dimen/activity_vertical_margin"
                android:background="@drawable/background_color">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/add_new_expense"
        android:textColor="@color/white"
        android:textSize="25dp"
        android:textStyle="bold"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="50dp"
        android:background="@color/white"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginBottom="10dp"
            android:layout_marginEnd="10dp"
            android:layout_marginStart="10dp"
            android:layout_marginTop="10dp"
            android:orientation="vertical">

            <EditText
                android:id="@+id/amount"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:inputType="number"
                android:hint="@string/amount"/>

            <Spinner
                android:id="@+id/expense_type"
                android:layout_width="match_parent"
                android:layout_height="50dp"
                android:layout_marginTop="15dp"
                android:entries="@array/expense_types"/>

            <Button
                style="@style/button_primary"
                android:layout_width="match_parent"
                android:layout_height="60dp"
                android:layout_marginTop="20dp"
                android:id="@+id/add_expense"
                android:text="@string/add_expense"/>
        </LinearLayout>
    </LinearLayout>
</RelativeLayout>


text:
package tectonicus.blockregistry;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.extern.log4j.Log4j2;
import tectonicus.BlockContext;
import tectonicus.blockregistry.BlockModel;
import tectonicus.raw.RawChunk;
import tectonicus.renderer.Geometry;

@Log4j2
@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class BlockStateModel {
	private String model = "";
	private BlockModel blockModel;
	@JsonProperty("x")
	private int xRotation = 0;
	@JsonProperty("y")
	private int yRotation = 0;
	private int weight = 1;
	private boolean uvlock = false;

	public void createGeometry(int x, int y, int z, BlockContext world, RawChunk rawChunk, Geometry geometry) {
		if(blockModel != null) {
			blockModel.createGeometry(x, y, z, world, rawChunk, geometry, xRotation, yRotation);  //TODO: pass in weight and uvlock
		} else {
			log.warn("No block model found for model: {}", model);
		}
	}
}