text:
<?php
/**
 * Piggyback EAV but use Mongo for storage
 *
 * NOT COMPLETE AND NOT WORKING
 */
abstract class Cm_Mongo_Model_Entity
    extends Mage_Eav_Model_Entity_Abstract
{

    const DEFAULT_ENTITY_ID_FIELD = '_id';

    /**
     * Resource initialization
     */
    protected function _construct()
    {

    }

    /**
     * Get entity id field name in entity table
     *
     * @return string
     */
    public function getEntityIdField()
    {
        if (empty($this->_entityIdField)) {
            $this->_entityIdField = $this->getEntityType()->getEntityIdField();
            if (empty($this->_entityIdField)) {
                $this->_entityIdField = self::DEFAULT_ENTITY_ID_FIELD;
            }
        }
        return $this->_entityIdField;
    }

    /**
     * Check whether the attribute is a real field in entity table
     *
     * @see Mage_Eav_Model_Entity_Abstract::getAttribute for $attribute format
     * @param integer|string|Mage_Eav_Model_Entity_Attribute_Abstract $attribute
     * @return unknown
     */
    public function isAttributeStatic($attribute)
    {
      return TRUE;
    }

    /**
     * Enter description here...
     *
     * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
     * @param Varien_Object $object
     * @return boolean
     */
    public function checkAttributeUniqueValue(Mage_Eav_Model_Entity_Attribute_Abstract $attribute, $object)
    {
        $value = $object->getData($attribute->getAttributeCode());
        if ($attribute->getBackend()->getType() == 'datetime'){
            $date = new Zend_Date($value);
            $value = $date->toString(Varien_Date::DATETIME_INTERNAL_FORMAT);
        }

        $data = $this->_getWriteAdapter()
            ->getCollection($this->getEntityTable())
            ->findOne(array(
                $attribute->getAttributeCode() => $value
            ), array($this->getEntityIdField() => 1));

        if ($object->getId()) {
            if ($data) {
                return $data[$this->getEntityIdField()] == $object->getId();
            }
            return true;
        }
        else {
            return ! $data;
        }
    }

    /**
     * Load entity's attributes into the object
     *
     * @param   Varien_Object $object
     * @param   integer $entityId
     * @param   array|null $attributes
     * @return  Mage_Eav_Model_Entity_Abstract
     */
    public function load($object, $entityId, $attributes=array())
    {
        /**
         * Load object base row data
         */
        if (empty($attributes)) {
            $this->loadAllAttributes($object);
            $attributes = array_keys($this->_attributesByCode);
        } else {
            foreach ($attributes as $attrCode) {
                $this->getAttribute($attrCode);
            }
        }

        array_fill_keys($attributes, 1);

        $row = $this->_getReadAdapter()
            ->getCollection($this->getEntityTable())
            ->findOne(array(
                $this->getEntityIdField() => $entityId
            ), $attributes);

        if (is_array($row)) {
            $object->addData($row);
            $object->_isNewObject(FALSE);
        }

        $object->setOrigData();
        Varien_Profiler::start('__MONGO_EAV_LOAD_MODEL_AFTER_LOAD__');
        $this->_afterLoad($object);
        Varien_Profiler::stop('__MONGO_EAV_LOAD_MODEL_AFTER_LOAD__');

        return $this;
    }

    /**
     * Save entity's attributes into the object's resource
     *
     * @param   Varien_Object $object
     * @return  Mage_Eav_Model_Entity_Abstract
     */
    public function save(Varien_Object $object)
    {
        if ($object->isDeleted()) {
            return $this->delete($object);
        }

        if (!$this->isPartialSave()) {
            $this->loadAllAttributes($object);
        }

        if (!$object->getEntityTypeId()) {
            $object->setEntityTypeId($this->getTypeId());
        }

        $this->_beforeSave($object);
        $this->_processSaveData($this->_collectSaveData($object));
        $this->_afterSave($object);

        return $this;
    }

    /**
     * Prepare entity object data for save
     *
     * result array structure:
     * array (
     *  'newObject', 'entityRow', 'insert', 'update', 'delete'
     * )
     *
     * @param   Varien_Object $newObject
     * @return  array
     */
    protected function _collectSaveData($newObject)
    {
        $newData   = $newObject->getData();
        $entityId  = $newObject->getData($this->getEntityIdField());

        // define result data
        $entityRow  = array();
        $insert     = array();
        $update     = array();
        $delete     = array();

        if (!empty($entityId)) {
            $origData = $newObject->getOrigData();
            /**
             * get current data in db for this entity if original data is empty
             */
            if (empty($origData) && $newObject->isNewObject() === FALSE) {
                $origData = $this->_getOrigObject($newObject)->getOrigData();
            }

            /**
             * drop attributes that are unknown in new data
             * not needed after introduction of partial entity loading
             */
            if($origData) {
                foreach ($origData as $k => $v) {
                    if (!array_key_exists($k, $newData)) {
                        unset($origData[$k]);
                    }
                }
            }
        } else {
            $origData = array();
        }

        $attributeCodes = array_keys($this->_attributesByCode);

        foreach ($newData as $k => $v) {
            /**
             * Check attribute information
             */
            if (is_numeric($k) || is_array($v)) {
                continue;
            }
            /**
             * Check if data key is presented in static fields or attribute codes
             */
            if (!in_array($k, $attributeCodes)) {
                continue;
            }

            $attribute = $this->getAttribute($k);
            if (empty($attribute)) {
                continue;
            }

            $attrCode = $attribute->getAttributeCode();

            /**
             * Check comparability for attribute value
             */
            if (array_key_exists($k, $origData)) {
                if ($this->_isAttributeValueEmpty($attribute, $v)) {
                    $delete[$attrCode] = 1;
                } else if ($v !== $origData[$k]) {
                    $update[$attrCode] = $v;
                }
            } else if (!$this->_isAttributeValueEmpty($attribute, $v)) {
                $insert[$attrCode] = $v;
            }
        }

        $result = compact('newObject', 'insert', 'update', 'delete');
        return $result;
    }

    /**
     * Save object collected data
     *
     * @param   array $saveData array('newObject', 'insert', 'update', 'delete')
     * @return  Mage_Eav_Model_Entity_Abstract
     */
    protected function _processSaveData($saveData)
    {
        $object = NULL; // ?
        $newObject = $saveData['new_Object'];
        $insert = $saveData['insert'];
        $update = $saveData['update'];
        $delete = $saveData['delete'];
        $entityIdField  = $this->getEntityIdField();
        $entityId       = $newObject->getId();
        $condition      = array($entityIdField => $entityId);

        // Upsert when status is unknown
        if ($object->isNewObject() === NULL) {
          $this->_getWriteAdapter()->getCollection($this->getEntityTable())
            ->update($condition, $insert+$update, array('upsert' => TRUE, 'multiple' => FALSE, 'safe' => TRUE));
        }

        // Insert new objects
        else if($object->isNewObject()) {
          if($update) {
            $this->_getWriteAdapter()->getCollection($this->getEntityTable())
              ->update($insert, $update, array('upsert' => TRUE, 'multiple' => FALSE, 'safe' => TRUE));
          }
          else {
            $this->_getWriteAdapter()->getCollection($this->getEntityTable())
              ->insert($insert, array('safe' => TRUE));
          }
        }

        // Update existing objects
        else {
            $this->_getWriteAdapter()->getCollection($this->getEntityTable())
              ->update($condition, $insert+$update, array('multiple' => FALSE, 'safe' => TRUE));
        }

        /**
         * insert attribute values
         */
        if (!empty($insert)) {
            foreach ($insert as $attrCode => $value) {
                $attribute = $this->getAttribute($attrCode);
                $this->_insertAttribute($newObject, $attribute, $value);
            }
        }

        /**
         * update attribute values
         */
        if (!empty($update)) {
            foreach ($update as $attrCode => $value) {
                $attribute = $this->getAttribute($attrCode);
                //$this->_updateAttribute($newObject, $attribute, $value);
            }
        }

        /**
         * delete empty attribute values
         */
        if (!empty($delete)) {
            foreach ($delete as $attrCode => $value) {
                //$this->_deleteAttributes($newObject, $attrCode);
            }
        }

        $this->_processAttributeValues();

        return $this;
    }

    /**
     * Set entity attribute value
     *
     * Collect for mass save
     *
     * @param Mage_Core_Model_Abstract $object
     * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
     * @param mixed $value
     * @return Mage_Eav_Model_Entity_Abstract
     */
    protected function _setAttribute($object, $attribute, $value)
    {
        $this->_attributeValuesToSave['$set'][$attribute->getAttributeCode()] = $this->_prepareValueForSave($value, $attribute);

        return $this;
    }

    /**
     * Prepare value for save
     *
     * @param mixed $value
     * @param Mage_Eav_Model_Entity_Attribute_Abstract $attribute
     * @return mixed
     */
    protected function _prepareValueForSave($value, Mage_Eav_Model_Entity_Attribute_Abstract $attribute)
    {
        if ($attribute->getBackendType() == 'decimal') {
            return Mage::app()->getLocale()->getNumber($value);
        }
        return $value;
    }

    /**
     * Save attribute
     *
     * @param Varien_Object $object
     * @param string $attributeCode
     * @return Mage_Eav_Model_Entity_Abstract
     */
    public function saveAttribute(Varien_Object $object, $attributeCode)
    {
        $attribute = $this->getAttribute($attributeCode);
        $backend = $attribute->getBackend();
        $entity = $attribute->getEntity();
        $entityIdField = $entity->getEntityIdField();

        $newValue = $object->getData($attributeCode);
        if ($attribute->isValueEmpty($newValue)) {
            $newValue = null;
        }

        $condition = array($object->getIdFieldName() => $object->getId());

        if ( ! is_null($newValue)) {
            $operation = array('$set' => array($attributeCode => $newValue));
        } else {
            $operation = array('$unset' => array($attributeCode => 1));
        }
        $this->_getWriteAdapter()->getCollection($this->getEntityTable())
          ->update($condition, $operation, array('multiple' => FALSE, 'safe' => TRUE));

        return $this;
    }

  /**
   * Delete entity using current object's data
   *
   * @param $object
   * @return Mage_Eav_Model_Entity_Abstract
   */
    public function delete($object)
    {
        if (is_numeric($object)) {
            $id = (int)$object;
        } elseif ($object instanceof Varien_Object) {
            $id = (int)$object->getId();
        }

        $this->_beforeDelete($object);

        $this->_getWriteAdapter()->getCollection($this->getEntityTable())->delete(array($this->getEntityIdField() => $id));

        $this->_afterDelete($object);
        return $this;
    }

}


text:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@color/title_background" />
    <corners android:radius="5dip"/>
    <stroke
        android:width="1dip"
        android:color="@color/title_background" />
</shape>

redpajama_set_name: RedPajamaGithub


text:
package org.apache.hadoop.mapred;

/**
 * A general identifier, which internally stores the id
 * as an integer. This is the super class of {@link JobID},
 * {@link TaskID} and {@link TaskAttemptID}.
 *
 * @see JobID
 * @see TaskID
 * @see TaskAttemptID
 */
public abstract class ID extends org.apache.hadoop.mapreduce.ID {

  /** constructs an ID object from the given int */
  public ID(int id) {
    super(id);
  }

  protected ID() {
  }

}


text:
shared_examples_for "a mongo adapter" do
  it_should_behave_like 'an adapter'

  it "allows using object id's as keys in correct type" do
    id = BSON::ObjectId.new
    attributes = {'one' => 'two'}
    adapter.write(id, attributes)
    expect(client.find_one('_id' => id)).not_to be_nil
    expect(adapter.read(id)).to eq(attributes)
  end

  it "allows using ordered hashes as keys" do
    key = BSON::OrderedHash['d', 1, 'n', 1]
    attributes = {'one' => 'two'}
    adapter.write(key, attributes)
    expect(client.find_one('_id' => key)).not_to be_nil
    expect(adapter.read(key)).to eq(attributes)
  end

  it "allows using hashes as keys" do
    key = {:d => 1}
    attributes = {'one' => 'two'}
    adapter.write(key, attributes)
    expect(client.find_one('_id' => key)).not_to be_nil
    expect(adapter.read(key)).to eq(attributes)
  end

  it "stores hashes right in document" do
    adapter.write('foo', 'steak' => 'bacon')
    expect(client.find_one('_id' => 'foo')).to eq({'_id' => 'foo', 'steak' => 'bacon'})
  end

  describe "with safe option" do
    context "set to true" do
      before do
        client.ensure_index([['email', 1]], :unique => true)
        @adapter = Adapter[adapter_name].new(client, :safe => true)
      end

      after do
        client.drop_index('email_1')
      end

      it "does not raise operation failure on write if operation succeeds" do
        adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
        expect {
          adapter.write(BSON::ObjectId.new, {'email' => 'steve@orderedlist.com'})
        }.not_to raise_error
      end

      it "raises operation failure on write if operation fails" do
        adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
        expect {
          adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
        }.to raise_error(Mongo::OperationFailure)
      end
    end

    context "set to false" do
      before do
        client.ensure_index([['email', 1]], :unique => true)
        @adapter = Adapter[adapter_name].new(client, :safe => false)
      end

      after do
        client.drop_index('email_1')
      end

      it "does not raise operation failure on write if operation succeeds" do
        adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
        expect {
          adapter.write(BSON::ObjectId.new, {'email' => 'steve@orderedlist.com'})
        }.not_to raise_error
      end

      it "does not raise operation failure on write if operation fails" do
        adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
        expect {
          adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
        }.not_to raise_error
      end
    end
  end

  describe "with :write_concern" do
    before do
      client.ensure_index([['email', 1]], :unique => true)
      @adapter = Adapter[adapter_name].new(client, :write_concern => {:w => 1})
    end

    after do
      client.drop_index('email_1')
    end

    it "does not raise operation failure on write if operation succeeds" do
      adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
      expect {
        adapter.write(BSON::ObjectId.new, {'email' => 'steve@orderedlist.com'})
      }.not_to raise_error
    end

    it "raises operation failure on write if operation fails" do
      adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
      expect {
        adapter.write(BSON::ObjectId.new, {'email' => 'john@orderedlist.com'})
      }.to raise_error(Mongo::OperationFailure)
    end

    it "allows overriding write concern for write" do
      id = BSON::ObjectId.new
      expect(client).to receive(:update).
        with(
          hash_including(:_id),
          kind_of(Hash),
          hash_including(:w => 0)
        )
      adapter.write(id, {:foo => 'bar'}, :w => 0)
    end

    it "uses write concern for delete" do
      id = BSON::ObjectId.new
      expect(client).to receive(:remove).with({:_id => id}, :w => 1)
      adapter.delete(id)
    end

    it "allows overriding write concern for delete" do
      id = BSON::ObjectId.new
      expect(client).to receive(:remove).with({:_id => id}, :w => 0)
      adapter.delete(id, :w => 0)
    end

    it "uses write concern for clear" do
      id = BSON::ObjectId.new
      expect(client).to receive(:remove).with({}, :w => 1)
      adapter.clear
    end

    it "allows overriding write concern for clear" do
      id = BSON::ObjectId.new
      expect(client).to receive(:remove).with({}, :w => 0)
      adapter.clear(:w => 0)
    end
  end
end


text:
package org.olat.course.nodes.dialog;

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

import org.olat.core.commons.modules.bc.FileUploadController;
import org.olat.core.commons.modules.bc.FolderConfig;
import org.olat.core.commons.modules.bc.FolderEvent;
import org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl;
import org.olat.core.gui.UserRequest;
import org.olat.core.gui.components.Component;
import org.olat.core.gui.components.link.Link;
import org.olat.core.gui.components.link.LinkFactory;
import org.olat.core.gui.components.tabbedpane.TabbedPane;
import org.olat.core.gui.components.table.TableController;
import org.olat.core.gui.components.table.TableGuiConfiguration;
import org.olat.core.gui.components.velocity.VelocityContainer;
import org.olat.core.gui.control.Controller;
import org.olat.core.gui.control.ControllerEventListener;
import org.olat.core.gui.control.Event;
import org.olat.core.gui.control.WindowControl;
import org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController;
import org.olat.core.gui.translator.PackageTranslator;
import org.olat.core.logging.activity.CourseLoggingAction;
import org.olat.core.logging.activity.ThreadLocalUserActivityLogger;
import org.olat.core.util.Util;
import org.olat.core.util.vfs.Quota;
import org.olat.course.ICourse;
import org.olat.course.assessment.AssessmentHelper;
import org.olat.course.condition.Condition;
import org.olat.course.condition.ConditionEditController;
import org.olat.course.editor.NodeEditController;
import org.olat.course.groupsandrights.CourseGroupManager;
import org.olat.course.nodes.BCCourseNode;
import org.olat.course.nodes.DialogCourseNode;
import org.olat.course.run.userview.UserCourseEnvironment;
import org.olat.course.tree.CourseEditorTreeModel;
import org.olat.modules.dialog.DialogElement;
import org.olat.modules.dialog.DialogElementsController;
import org.olat.modules.dialog.DialogElementsPropertyManager;
import org.olat.modules.dialog.DialogElementsTableModel;
import org.olat.modules.dialog.DialogPropertyElements;
import org.olat.modules.fo.Forum;
import org.olat.modules.fo.ForumManager;
import org.olat.util.logging.activity.LoggingResourceable;

/**
 * Description:

 * controller for the tabbed pane inside the course editor for the course node 'dialog elements'
 *

 * Initial Date: 02.11.2005

 *
 * @author guido
 */
public class DialogCourseNodeEditController extends ActivateableTabbableDefaultController implements ControllerEventListener {

	private static final String PANE_TAB_DIALOGCONFIG = "pane.tab.dialogconfig";
	private static final String PANE_TAB_ACCESSIBILITY = "pane.tab.accessibility";

	private static final String[] paneKeys = { PANE_TAB_DIALOGCONFIG, PANE_TAB_ACCESSIBILITY };

	private VelocityContainer content, accessContent;
	private DialogCourseNode courseNode;
	private ConditionEditController readerCondContr, posterCondContr, moderatorCondContr;
	private TabbedPane myTabbedPane;
	private BCCourseNode bcNode = new BCCourseNode();
	private ICourse course;
	private DialogConfigForm configForumLaunch;
	private TableController tableCtr;
	private PackageTranslator resourceTrans;
	private FileUploadController fileUplCtr;
	private DialogElement recentElement;
	private TableGuiConfiguration tableConf;
	private Link uploadButton;

	public DialogCourseNodeEditController(UserRequest ureq, WindowControl wControl, DialogCourseNode node,
			ICourse course, UserCourseEnvironment userCourseEnv) {
		super(ureq,wControl);
		//o_clusterOk by guido: save to hold reference to course inside editor
		this.course = course;
		this.courseNode = node;

		this.resourceTrans = new PackageTranslator(Util.getPackageName(DialogElementsTableModel.class), ureq.getLocale(), getTranslator());
		// set name of the folder we use
		bcNode.setShortTitle(translate("dialog.folder.name"));

		// dialog specific config tab
		content = this.createVelocityContainer("edit");
		uploadButton = LinkFactory.createButton("dialog.upload.file", content, this);

		//configure table
		tableConf = new TableGuiConfiguration();
		tableConf.setResultsPerPage(10);
		showOverviewTable(ureq);

		initConfigForm(ureq);

		// accessability config tab
		accessContent = this.createVelocityContainer("edit_access");

		CourseGroupManager groupMgr = course.getCourseEnvironment().getCourseGroupManager();
		CourseEditorTreeModel editorModel = course.getEditorTreeModel();
		// Reader precondition
		Condition readerCondition = courseNode.getPreConditionReader();
		// TODO:gs:a getAssessableNodes ist der dialog node assessable oder nicht?
		readerCondContr = new ConditionEditController(ureq, getWindowControl(), groupMgr, readerCondition, "readerConditionForm",
				AssessmentHelper.getAssessableNodes(editorModel, courseNode), userCourseEnv);
    this.listenTo(readerCondContr);
		accessContent.put("readerCondition", readerCondContr.getInitialComponent());

		// Poster precondition
		Condition posterCondition = courseNode.getPreConditionPoster();
		posterCondContr = new ConditionEditController(ureq, getWindowControl(), groupMgr, posterCondition, "posterConditionForm",
				AssessmentHelper.getAssessableNodes(editorModel, courseNode), userCourseEnv);
		this.listenTo(posterCondContr);
		accessContent.put("posterCondition", posterCondContr.getInitialComponent());

		// Moderator precondition
		Condition moderatorCondition = courseNode.getPreConditionModerator();
		moderatorCondContr = new ConditionEditController(ureq, getWindowControl(), groupMgr, moderatorCondition, "moderatorConditionForm",
				AssessmentHelper.getAssessableNodes(editorModel, courseNode), userCourseEnv);
		//FIXME:gs: why is firing needed here?
		fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
		this.listenTo(moderatorCondContr);
		accessContent.put("moderatorCondition", moderatorCondContr.getInitialComponent());
	}

	private void initConfigForm(UserRequest ureq) {

		removeAsListenerAndDispose(configForumLaunch);
		configForumLaunch = new DialogConfigForm(ureq, getWindowControl(), courseNode.getModuleConfiguration());
		listenTo(configForumLaunch);

		content.put("showForumAsPopupConfigForm", configForumLaunch.getInitialComponent());
	}

	/**
	 * @see org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController#getPaneKeys()
	 */
	public String[] getPaneKeys() {
		return paneKeys;
	}

	/**
	 * @see org.olat.core.gui.control.generic.tabbable.ActivateableTabbableDefaultController#getTabbedPane()
	 */
	public TabbedPane getTabbedPane() {
		return myTabbedPane;
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
	 *      org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
	 */
	public void event(UserRequest ureq, Component source, Event event) {
		if (source == uploadButton) {
			Forum forum = ForumManager.getInstance().addAForum();
			OlatRootFolderImpl forumContainer = DialogElementsController.getForumContainer(forum.getKey());

			removeAsListenerAndDispose(fileUplCtr);
			fileUplCtr = new FileUploadController(getWindowControl(),forumContainer, ureq, (int)FolderConfig.getLimitULKB(), Quota.UNLIMITED, null, false);
			listenTo(fileUplCtr);

			recentElement = new DialogElement();
			recentElement.setForumKey(forum.getKey());
			recentElement.setAuthor(ureq.getIdentity().getName());
			content.contextPut("overview", Boolean.FALSE);
			content.put("upload", fileUplCtr.getInitialComponent());
		}
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
	 *      org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
	 */
	public void event(UserRequest ureq, Controller source, Event event) {
		if (source == configForumLaunch) {
			if (event == Event.CHANGED_EVENT) {
				fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
			}
		} else if (source == readerCondContr) {
			if (event == Event.CHANGED_EVENT) {
				Condition cond = readerCondContr.getCondition();
				courseNode.setPreConditionReader(cond);
				fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
			}
		} else if (source == posterCondContr) {
			if (event == Event.CHANGED_EVENT) {
				Condition cond = posterCondContr.getCondition();
				courseNode.setPreConditionPoster(cond);
				fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
			}
		} else if (source == moderatorCondContr) {
			if (event == Event.CHANGED_EVENT) {
				Condition cond = moderatorCondContr.getCondition();
				courseNode.setPreConditionModerator(cond);
				fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT);
			}
		} else if (source == tableCtr) {
			// process table events
		} else if (source == fileUplCtr) {
			// event.
			if (event == Event.DONE_EVENT || event == Event.CANCELLED_EVENT) {
				// reset recent element
				recentElement = null;
				showOverviewTable(ureq);
			} else if (event.getCommand().equals(FolderEvent.UPLOAD_EVENT)) {

				// new dialog element
				DialogElement element = new DialogElement();
				element.setAuthor(recentElement.getAuthor());
				element.setDate(new Date());
				final String filename = ((FolderEvent) event).getFilename();
				element.setFilename(filename);
				element.setForumKey(recentElement.getForumKey());
				element.setFileSize(DialogElementsController.getFileSize(recentElement.getForumKey()));

				// save property
				DialogElementsPropertyManager.getInstance().addDialogElement(course.getCourseEnvironment().getCoursePropertyManager(), courseNode, element);

				// do logging
				ThreadLocalUserActivityLogger.log(CourseLoggingAction.DIALOG_ELEMENT_FILE_UPLOADED, getClass(),
						LoggingResourceable.wrapUploadFile(filename));
			}
		}
	}
/**
 * update table with latest elements
 * @param ureq
 */
	private void showOverviewTable(UserRequest ureq) {

		removeAsListenerAndDispose(tableCtr);
		tableCtr = new TableController(tableConf, ureq, getWindowControl(), resourceTrans);
		listenTo(tableCtr);

		DialogPropertyElements elements = DialogElementsPropertyManager.getInstance().findDialogElements(this.course.getCourseEnvironment().getCoursePropertyManager(), courseNode);
		List list = new ArrayList();
		DialogElementsTableModel tableModel = new DialogElementsTableModel(getTranslator(), null, null);
		if (elements != null) list = elements.getDialogPropertyElements();
		tableModel.setEntries(list);
		tableModel.addColumnDescriptors(tableCtr);
		tableCtr.setTableDataModel(tableModel);
		tableCtr.modelChanged();
		tableCtr.setSortColumn(1, true);
		content.contextPut("overview", Boolean.TRUE);
		content.put("dialogElementsTable", tableCtr.getInitialComponent());
	}

	/**
	 * @see org.olat.core.gui.control.DefaultController#doDispose(boolean)
	 */
	protected void doDispose() {
    //child controllers registered with listenTo() get disposed in BasicController
	}

	/**
	 * @see org.olat.core.gui.control.generic.tabbable.TabbableController#addTabs(org.olat.core.gui.components.tabbedpane.TabbedPane)
	 */
	public void addTabs(TabbedPane tabbedPane) {
		tabbedPane.addTab(translate(PANE_TAB_ACCESSIBILITY), accessContent);
		tabbedPane.addTab(translate(PANE_TAB_DIALOGCONFIG), content);
	}

}


text:
Extracts the hash risk list from the recorded future and creates indicators accordingly.

## Script Data
---

| **Name** | **Description** |
| --- | --- |
| Script Type | python |
| Tags | RecordedFuture |

## Inputs
---

| **Argument Name** | **Description** |
| --- | --- |
| list | Specifies a hash list by a risk rule name, which can be retrieved with the `get-hash-riskrules` command. |
| threshold | The minimum threshold score to consider indicators as malicious (65-99, greater than or equal to). |

## Outputs
---

| **Path** | **Description** | **Type** |
| --- | --- | --- |
| InfoFile.Name | The name of the file. | string |
| InfoFile.EntryID | The entry ID of the file. | string |
| InfoFile.Size | The size of the file. | number |
| InfoFile.Type | The type of the file. For example, "PE". | string |
| InfoFile.Info | The basic information of the file. | string |
| InfoFile.Extension | The extension of the file. | string |


text:
	#pragma once
#endif

#include <qobject.h>
#include <qprocess.h>
#include <qtextcodec.h>

class chanRuntimeEnvironment:public QObject{
	Q_OBJECT

public:
	static chanRuntimeEnvironment& getRuntimeEnvironment(){
		static chanRuntimeEnvironment object;
		return object;
	}

signals:
	void outputString(const QString&);
	void errorString(const QString&);
	void finished(bool);

public slots:
	void run(const QString&);
	void kill();

private:
	chanRuntimeEnvironment():m_textCodec(QTextCodec::codecForLocale()){
		connect(&m_process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finish()));
		connect(&m_process, SIGNAL(readyReadStandardError()), this, SLOT(getErrorString()));
		connect(&m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(getOutputString()));

	}

	chanRuntimeEnvironment(const chanRuntimeEnvironment&) = delete;
	chanRuntimeEnvironment& operator =(const chanRuntimeEnvironment&) = delete;

private slots:
	void getOutputString();
	void getErrorString();
	void setInputString(const QString&);
	void finish();

private:
	QProcess m_process;
	QTextCodec* m_textCodec;
};

#endif


text:
package sh.isaac.komet.preferences.coordinate;

import sh.isaac.api.preferences.IsaacPreferences;
import sh.isaac.komet.preferences.ParentPanel;
import sh.komet.gui.contract.preferences.KometPreferencesController;
import sh.komet.gui.control.property.ActivityFeed;
import sh.komet.gui.control.property.ViewProperties;
import sh.komet.gui.util.FxGet;

import java.util.Optional;
import java.util.prefs.BackingStoreException;

import static sh.isaac.komet.preferences.coordinate.ManifoldCoordinateItemPanel.Keys.MANIFOLD_GROUP_UUID;
import static sh.komet.gui.contract.preferences.PreferenceGroup.Keys.GROUP_NAME;
/*
@Deprecated There is no longer an association between ManifoldCoordinates and ActivityFeeds...
 */
@Deprecated
public class ManifoldCoordinateGroupPanel extends ParentPanel {

    public ManifoldCoordinateGroupPanel(IsaacPreferences preferencesNode, ViewProperties viewProperties, KometPreferencesController kpc) {
        super(preferencesNode, preferencesNode.get(GROUP_NAME, "Manifold"), viewProperties, kpc);
        if (!initialized()) {
            // add each default manifold...
            // Activity feed loop removed. TODO delete this class?
            save();
        }
    }

    @Override
    protected Class getChildClass() {
        return ManifoldCoordinateItemPanel.class;
    }

    @Override
    protected void saveFields() throws BackingStoreException {

    }

    @Override
    protected void revertFields() {
        // nothing to revert
    }
}


text:
ReportPortal is a service, that provides increased capabilities to speed up results analysis and reporting through the use of built-in analytic features.

ReportPortal is a great addition to Continuous Integration and Continuous
Testing process.

**What ReportPortal can do?**

- ***Mainstream platforms integration***
ReportPortal seamlessly integrates with mainstream platforms such as Jenkins, Jira, BDD process, majority of Functional and Unit testing frameworks.

- ***Real-time integration***
Real-time integration provides businesses the ability to manage and track execution status directly from the ReportPortal.

- ***Test case execution results structure***
Test case execution results are stored following the same structure you have in your reporting suites and test plan. The test cases are shown together with all related data in one place, right where you need it: logs, screenshots, binary data. The execution pipeline of certain test cases are also available for you, so one can see previous execution results in one click.

- ***Collaborative analysis***
ReportPortal also gives you the ability to collaboratively analyze the test automation results. Particular test cases can be associated with a product bug, an automation issue, a system issue or can be submitted as an issue ticket directly from the execution result.

- ***Historical data of test execution***
ReportPortal provides enhanced capabilities along with auto-results analysis by
leveraging historical data of test execution.

- ***Automatic Analysis***
With each execution, ReportPortal automatically figures out the root cause of a fail. As a result of this analysis, ReportPortal is marking a test result with a flag. Engineers will be alerted about this issue to provide further analysis: if it has been resolved already or which test results require actual human analysis.

**What technologies are used?**

Considering a high load rate and performance requirements, we use
cutting edge technologies such as:

-   PostgreSQL -The World's Most Advanced Open Source Relational Database.

-   REST Web Service - lightweight requests, industry standard.

-   Mobile responsive UI - check it at any mobile device with the default browser.


text:
/**
 * Write a function that makes a deep copy of an object.
 The function should work for both primitive and reference types.
 */

    // test objects
var person={
    name:'Pesho',
    surname:'Peshov',
    age:32,
    fullName:function(){
        return this.name+' '+this.surname;
    }
};

var anotherPerson=deepCopy(person);
person.age=22;
console.log('Person is ' + person.fullName() + ' age:' + person.age);
console.log('Another person is ' + anotherPerson.fullName() + ' age:' + anotherPerson.age);

console.log(deepCopy(5));

function deepCopy(obj) {
    if(obj === null || typeof(obj) !== 'object')
        return obj;

    var temp = {};

    for(var key in obj) {
        if(Object.prototype.hasOwnProperty.call(obj, key)) {
            temp[key] = deepCopy(obj[key]);
        }
    }
    return temp;
}


text:
package io.gatling.mqtt.check

import scala.concurrent.duration.FiniteDuration

import io.gatling.core.session.Expression

final case class MqttExpectation(checks: List[MqttCheck], timeout: FiniteDuration, topic: Option[Expression[String]], blocking: Boolean)


text:
package org.apache.hadoop.hdfs.server.diskbalancer;

import org.apache.hadoop.fs.StorageType;
import org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerCluster;
import org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerDataNode;
import org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerVolume;
import org.apache.hadoop.hdfs.server.diskbalancer.datamodel.DiskBalancerVolumeSet;
import org.junit.Assert;
import org.junit.Test;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeSet;
import java.util.UUID;

/**
 * Tests DiskBalancer Data models.
 */
public class TestDataModels {
  @Test
  public void testCreateRandomVolume() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerVolume vol = util.createRandomVolume(StorageType.DISK);
    Assert.assertNotNull(vol.getUuid());
    Assert.assertNotNull(vol.getPath());
    Assert.assertNotNull(vol.getStorageType());
    Assert.assertFalse(vol.isFailed());
    Assert.assertFalse(vol.isTransient());
    Assert.assertTrue(vol.getCapacity() > 0);
    Assert.assertTrue((vol.getCapacity() - vol.getReserved()) > 0);
    Assert.assertTrue((vol.getReserved() + vol.getUsed()) < vol.getCapacity());
  }

  @Test
  public void testCreateRandomVolumeSet() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerVolumeSet vSet =
        util.createRandomVolumeSet(StorageType.SSD, 10);
    Assert.assertEquals(10, vSet.getVolumeCount());
    Assert.assertEquals(StorageType.SSD.toString(),
        vSet.getVolumes().get(0).getStorageType());

  }

  @Test
  public void testCreateRandomDataNode() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerDataNode node = util.createRandomDataNode(
        new StorageType[]{StorageType.DISK, StorageType.RAM_DISK}, 10);
    Assert.assertNotNull(node.getNodeDataDensity());
  }

  @Test
  public void testDiskQueues() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerDataNode node = util.createRandomDataNode(
        new StorageType[]{StorageType.DISK, StorageType.RAM_DISK}, 3);
    TreeSet<DiskBalancerVolume> sortedQueue =
        node.getVolumeSets().get(StorageType.DISK.toString()).getSortedQueue();

    List<DiskBalancerVolume> reverseList = new LinkedList<>();
    List<DiskBalancerVolume> highList = new LinkedList<>();
    int queueSize = sortedQueue.size();
    for (int x = 0; x < queueSize; x++) {
      reverseList.add(sortedQueue.first());
      highList.add(sortedQueue.first());
    }
    Collections.reverse(reverseList);

    for (int x = 0; x < queueSize; x++) {

      Assert.assertEquals(reverseList.get(x).getCapacity(),
          highList.get(x).getCapacity());
      Assert.assertEquals(reverseList.get(x).getReserved(),
          highList.get(x).getReserved());
      Assert.assertEquals(reverseList.get(x).getUsed(),
          highList.get(x).getUsed());
    }
  }

  @Test
  public void testNoBalancingNeededEvenDataSpread() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerDataNode node =
        new DiskBalancerDataNode(UUID.randomUUID().toString());

    // create two disks which have exactly same data and isBalancing should
    // say we don't need to balance.
    DiskBalancerVolume v1 = util.createRandomVolume(StorageType.SSD);
    v1.setCapacity(DiskBalancerTestUtil.TB);
    v1.setReserved(100 * DiskBalancerTestUtil.GB);
    v1.setUsed(500 * DiskBalancerTestUtil.GB);

    DiskBalancerVolume v2 = util.createRandomVolume(StorageType.SSD);
    v2.setCapacity(DiskBalancerTestUtil.TB);
    v2.setReserved(100 * DiskBalancerTestUtil.GB);
    v2.setUsed(500 * DiskBalancerTestUtil.GB);

    node.addVolume(v1);
    node.addVolume(v2);

    for (DiskBalancerVolumeSet vsets : node.getVolumeSets().values()) {
      Assert.assertFalse(vsets.isBalancingNeeded(10.0f));
    }
  }

  @Test
  public void testNoBalancingNeededTransientDisks() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerDataNode node =
        new DiskBalancerDataNode(UUID.randomUUID().toString());

    // create two disks which have different data sizes, but
    // transient. isBalancing should say no balancing needed.
    DiskBalancerVolume v1 = util.createRandomVolume(StorageType.RAM_DISK);
    v1.setCapacity(DiskBalancerTestUtil.TB);
    v1.setReserved(100 * DiskBalancerTestUtil.GB);
    v1.setUsed(1 * DiskBalancerTestUtil.GB);

    DiskBalancerVolume v2 = util.createRandomVolume(StorageType.RAM_DISK);
    v2.setCapacity(DiskBalancerTestUtil.TB);
    v2.setReserved(100 * DiskBalancerTestUtil.GB);
    v2.setUsed(500 * DiskBalancerTestUtil.GB);

    node.addVolume(v1);
    node.addVolume(v2);

    for (DiskBalancerVolumeSet vsets : node.getVolumeSets().values()) {
      Assert.assertFalse(vsets.isBalancingNeeded(10.0f));
    }
  }

  @Test
  public void testNoBalancingNeededFailedDisks() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerDataNode node =
        new DiskBalancerDataNode(UUID.randomUUID().toString());

    // create two disks which have which are normal disks, but fail
    // one of them. VolumeSet should say no balancing needed.
    DiskBalancerVolume v1 = util.createRandomVolume(StorageType.SSD);
    v1.setCapacity(DiskBalancerTestUtil.TB);
    v1.setReserved(100 * DiskBalancerTestUtil.GB);
    v1.setUsed(1 * DiskBalancerTestUtil.GB);
    v1.setFailed(true);

    DiskBalancerVolume v2 = util.createRandomVolume(StorageType.SSD);
    v2.setCapacity(DiskBalancerTestUtil.TB);
    v2.setReserved(100 * DiskBalancerTestUtil.GB);
    v2.setUsed(500 * DiskBalancerTestUtil.GB);

    node.addVolume(v1);
    node.addVolume(v2);

    for (DiskBalancerVolumeSet vsets : node.getVolumeSets().values()) {
      Assert.assertFalse(vsets.isBalancingNeeded(10.0f));
    }
  }

  @Test
  public void testNeedBalancingUnevenDataSpread() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerDataNode node =
        new DiskBalancerDataNode(UUID.randomUUID().toString());

    DiskBalancerVolume v1 = util.createRandomVolume(StorageType.SSD);
    v1.setCapacity(DiskBalancerTestUtil.TB);
    v1.setReserved(100 * DiskBalancerTestUtil.GB);
    v1.setUsed(0);

    DiskBalancerVolume v2 = util.createRandomVolume(StorageType.SSD);
    v2.setCapacity(DiskBalancerTestUtil.TB);
    v2.setReserved(100 * DiskBalancerTestUtil.GB);
    v2.setUsed(500 * DiskBalancerTestUtil.GB);

    node.addVolume(v1);
    node.addVolume(v2);

    for (DiskBalancerVolumeSet vsets : node.getVolumeSets().values()) {
      Assert.assertTrue(vsets.isBalancingNeeded(10.0f));
    }
  }

  @Test
  public void testVolumeSerialize() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();
    DiskBalancerVolume volume = util.createRandomVolume(StorageType.DISK);
    String originalString = volume.toJson();
    DiskBalancerVolume parsedVolume =
        DiskBalancerVolume.parseJson(originalString);
    String parsedString = parsedVolume.toJson();
    Assert.assertEquals(originalString, parsedString);
  }

  @Test
  public void testClusterSerialize() throws Exception {
    DiskBalancerTestUtil util = new DiskBalancerTestUtil();

    // Create a Cluster with 3 datanodes, 3 disk types and 3 disks in each type
    // that is 9 disks in each machine.
    DiskBalancerCluster cluster = util.createRandCluster(3, new StorageType[]{
        StorageType.DISK, StorageType.RAM_DISK, StorageType.SSD}, 3);

    DiskBalancerCluster newCluster =
        DiskBalancerCluster.parseJson(cluster.toJson());
    Assert.assertEquals(cluster.getNodes(), newCluster.getNodes());
    Assert
        .assertEquals(cluster.getNodes().size(), newCluster.getNodes().size());
  }
}


text:
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else if(typeof exports === 'object')
		exports["Parallax"] = factory();
	else
		root["Parallax"] = factory();
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};

/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {

/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId])
/******/ 			return installedModules[moduleId].exports;

/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			exports: {},
/******/ 			id: moduleId,
/******/ 			loaded: false
/******/ 		};

/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);

/******/ 		// Flag the module as loaded
/******/ 		module.loaded = true;

/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}

/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;

/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;

/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";

/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

	var _helpersHelpers = __webpack_require__(1);

	var _Stage = __webpack_require__(2);

	var _Stage2 = _interopRequireDefault(_Stage);

	var _Canvas = __webpack_require__(4);

	var _Canvas2 = _interopRequireDefault(_Canvas);

	var _riotObservable = __webpack_require__(3);

	var _riotObservable2 = _interopRequireDefault(_riotObservable);

	/**
	 * There is no need to listen several times all the window events
	 * with this class we listen them once and we subscribe/unsubscribe all the Parallax instances to the main events dispatcher
	 * @type {Stage}
	 */
	var stage;

	/**
	 * @class
	 * An awesome script
	 */

	var Parallax = (function () {
	  function Parallax(els) {
	    var opts = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

	    _classCallCheck(this, Parallax);

	    // make this object observable
	    (0, _riotObservable2['default'])(this);
	    // set the options extending the _defaults
	    this.opts = opts;
	    this.canvases = [];
	    this.add(els);
	    if (!this.canvases.length) return console.warn('No images were found with the selector "' + els + '"'); // undefined
	    // lazy stage instance initialization
	    if (!stage) stage = new _Stage2['default']();

	    return this;
	  }

	  /**
	   * Initialize the parallax
	   * @returns { Object } - Parallax
	   */

	  _createClass(Parallax, [{
	    key: 'init',
	    value: function init() {
	      this.imagesLoaded = 0;
	      this.bind();
	      return this;
	    }

	    /**
	     * Bind the instance events setting all the callbacks
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'bind',
	    value: function bind() {
	      var _this = this;

	      // cache these function in order to unbind them when
	      // this instance will be destroyed
	      this._onResize = function () {
	        for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
	          args[_key] = arguments[_key];
	        }

	        return _this.resize.apply(_this, args);
	      };
	      this._onScroll = function () {
	        for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
	          args[_key2] = arguments[_key2];
	        }

	        return _this.scroll.apply(_this, args);
	      };

	      stage.on('resize', this._onResize);
	      stage.on('scroll', this._onScroll);

	      this.canvases.forEach(function (canvas) {
	        canvas.one('loaded', function () {
	          return _this.onCanvasLoaded(canvas);
	        });
	        canvas.load();
	      });

	      return this;
	    }

	    /**
	     * Force manually a redraw
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'refresh',
	    value: function refresh() {
	      this.onResize(stage.size).onScroll(stage.scrollTop);
	      return this;
	    }

	    /**
	     * Callback triggered once a canvas has loaded its image
	     * @param   { Object } canvas - canvas instance
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'onCanvasLoaded',
	    value: function onCanvasLoaded(canvas) {
	      this.trigger('image:loaded', canvas.img, canvas);
	      this.imagesLoaded++;
	      canvas.draw(stage);
	      if (this.imagesLoaded == this.canvases.length) this.trigger('images:loaded');
	      return this;
	    }

	    /**
	     * Callback triggered on scroll
	     * @param   { Number } scrollTop - page offset top
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'scroll',
	    value: function scroll(scrollTop) {
	      var i = this.canvases.length;

	      while (i--) {

	        var canvas = this.canvases[i],
	            stageScrollTop = stage.scrollTop,
	            canvasHeight = canvas.size.height,
	            offsetYBounds = this.opts.offsetYBounds,
	            canvasOffset = canvas.offset,
	            canvasScrollDelta = canvasOffset.top + canvasHeight - stageScrollTop;

	        if (canvas.isLoaded && canvasScrollDelta + offsetYBounds > 0 && canvasScrollDelta - offsetYBounds < stageScrollTop + stage.height) {
	          canvas.draw(stage);
	          this.trigger('draw', canvas.img);
	        }
	      }

	      return this;
	    }

	    /**
	     * Add parallax elements to this parallax instance
	     * @param { String|Array } els - DOM selector or node list
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'add',
	    value: function add(els) {
	      this.canvases = this.canvases.concat(this.createCanvases((0, _helpersHelpers.$$)(els)));
	      return this;
	    }

	    /**
	     * Remove parallax elements from this parallax instance
	     * @param { String|Array } els - DOM selector or node list
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'remove',
	    value: function remove(els) {
	      var _this2 = this;

	      (0, _helpersHelpers.$$)(els).forEach(function (el) {
	        var i = _this2.canvases.length;
	        while (i--) {
	          if (el == _this2.canvases[i].img) {
	            _this2.canvases.splice(i, 1);
	            break;
	          }
	        }
	      });
	      return this;
	    }

	    /**
	     * Kill all the internal and external callbacks listening this instance events
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'destroy',
	    value: function destroy() {
	      this.off('*');
	      stage.off('resize', this._onResize).off('scroll', this._onScroll);
	      return this;
	    }

	    /**
	     * Callback triggered on window resize
	     * @param   { Object } size - object containing the window width and height
	     * @returns { Object } - Parallax
	     */
	  }, {
	    key: 'resize',
	    value: function resize(size) {
	      var i = this.canvases.length;
	      while (i--) {
	        var canvas = this.canvases[i];
	        if (!canvas.isLoaded) return;
	        canvas.update().draw(stage);
	      }
	      this.trigger('resize');
	      return this;
	    }

	    /**
	     * Set the canvases instances
	     * @param   { Array } els - list of the images we want to parallax
	     * @returns { Array } - list of canvas instances
	     */
	  }, {
	    key: 'createCanvases',
	    value: function createCanvases(els) {
	      var _this3 = this;

	      return els.map(function (el) {
	        var data = (0, _helpersHelpers.elementData)(el);
	        return new _Canvas2['default'](el, {
	          intensity: !(0, _helpersHelpers.isUndefined)(data.intensity) ? +data.intensity : _this3.opts.intensity,
	          center: !(0, _helpersHelpers.isUndefined)(data.center) ? +data.center : _this3.opts.center
	        });
	      });
	    }

	    /**
	     * The options will be always set extending the script _defaults
	     * @param   { Object } opts - custom options
	     */
	  }, {
	    key: 'opts',
	    set: function set(opts) {
	      this._defaults = {
	        offsetYBounds: 50,
	        intensity: 30,
	        center: 0.5
	      };
	      (0, _helpersHelpers.extend)(this._defaults, opts);
	    },

	    /**
	     * Get the script options object
	     * @returns { Object } - current options
	     */
	    get: function get() {
	      return this._defaults;
	    }
	  }]);

	  return Parallax;
	})();

	exports['default'] = Parallax;
	module.exports = exports['default'];

/***/ },
/* 1 */
/***/ function(module, exports) {

	/**
	 * @module hepers
	 * All the helper functions needed in this project
	 */
	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});
	exports['default'] = {
	  /**
	   * Shorter and fast way to select multiple nodes in the DOM
	   * @param   { String|Array } selector - DOM selector or nodes list
	   * @param   { Object } ctx - DOM node where the targets of our search will is located
	   * @returns { Object } dom nodes found
	   */
	  $$: function $$(selector, ctx) {
	    var els;
	    if (typeof selector == 'string') els = (ctx || document).querySelectorAll(selector);else els = selector;
	    return Array.prototype.slice.call(els);
	  },

	  /**
	   * Shorter and fast way to select a single node in the DOM
	   * @param   { String } selector - unique dom selector
	   * @param   { Object } ctx - DOM node where the target of our search will is located
	   * @returns { Object } dom node found
	   */
	  $: function $(selector, ctx) {
	    return (ctx || document).querySelector(selector);
	  },
	  /**
	   * Extend any object with other properties
	   * @param   { Object } src - source object
	   * @returns { Object } the resulting extended object
	   *
	   * var obj = { foo: 'baz' }
	   * extend(obj, {bar: 'bar', foo: 'bar'})
	   * console.log(obj) => {bar: 'bar', foo: 'bar'}
	   *
	   */
	  extend: function extend(src) {
	    var obj,
	        args = arguments;
	    for (var i = 1; i < args.length; ++i) {
	      if (obj = args[i]) {
	        for (var key in obj) {
	          src[key] = obj[key];
	        }
	      }
	    }
	    return src;
	  },
	  /**
	   * Check if a value is undefined
	   * @param   { * }  val - test value
	   * @returns {Boolean} - true if it's undefined
	   */
	  isUndefined: function isUndefined(val) {
	    return typeof val == 'undefined';
	  },
	  /**
	   * Get the data-* of any DOM element
	   * @param   { Object } el - DOM element we want to parse
	   * @param   { String } attr - specific data attribute we want to get
	   * @returns { String|Object } - value/values of the data attributes
	   */
	  elementData: function elementData(el, attr) {
	    if (attr) return el.dataset[attr] || el.getAttribute('data-' + attr);else return el.dataset || Array.prototype.slice.call(el.attributes).reduce(function (ret, attribute) {
	      if (/data-/.test(attribute.name)) ret[attribute.name] = attribute.value;
	      return ret;
	    }, {});
	  },
	  /**
	   * Prefix any fancy browser object property
	   * @param   { Object } obj - object we want to update normally el.style
	   * @param   { String } prop - the new object property we want to set
	   * @param   { * } value - new value we want to assign to the prefixed property
	   * @returns { Boolean } - return whether the feature is supported
	   */
	  prefix: function prefix(obj, prop, value) {
	    var prefixes = ['ms', 'o', 'Moz', 'webkit', ''],
	        i = prefixes.length;
	    while (i--) {
	      var prefix = prefixes[i],

	      // check if the prefix exists othewise we will use the unprefixed version
	      // 4 ex using Transform: transform, webkitTransform, MozTransform, oTransform, msTransform
	      p = prefix ? prefix + prop[0].toUpperCase() + prop.substr(1) : prop.toLowerCase() + prop.substr(1);
	      if (p in obj) {
	        obj[p] = value;
	        return true;
	      }
	    }
	    return false;
	  }
	};
	module.exports = exports['default'];

/***/ },
/* 2 */
/***/ function(module, exports, __webpack_require__) {

	/**
	 * This class listens all the window events that could be reused by the Parallax instance
	 */

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

	var _riotObservable = __webpack_require__(3);

	var _riotObservable2 = _interopRequireDefault(_riotObservable);

	var rAF = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame || function (cb) {
	  setTimeout(cb, 1000 / 60);
	},
	    RESIZE_DELAY = 20;

	var Stage = (function () {
	  function Stage() {
	    _classCallCheck(this, Stage);

	    // make this object observable
	    (0, _riotObservable2['default'])(this);
	    this.resizeTimer = null;
	    this.tick = false;
	    this.bind();
	  }

	  /**
	   * Bind the window events
	   * @returns { Object } - Stage
	   */

	  _createClass(Stage, [{
	    key: 'bind',
	    value: function bind() {
	      var _this = this;

	      window.addEventListener('scroll', function () {
	        return _this.scroll();
	      }, true);
	      window.addEventListener('mousewheel', function () {
	        return _this.scroll();
	      }, true);
	      window.addEventListener('touchmove', function () {
	        return _this.scroll();
	      }, true);
	      window.addEventListener('resize', function () {
	        return _this.resize();
	      }, true);
	      window.addEventListener('orientationchange', function () {
	        return _this.resize();
	      }, true);
	      window.onload = function () {
	        return _this.scroll();
	      }; // force an update event

	      return this;
	    }

	    /**
	     * Handle a smooth scroll event dispatching the scrolling event outside
	     * @returns { Object } - Stage
	     */
	  }, {
	    key: 'scroll',
	    value: function scroll() {
	      var _this2 = this;

	      if (this.tick) return this;
	      this.tick = !this.tick;
	      rAF(function () {
	        return _this2.update();
	      });
	      return this;
	    }

	    /**
	     * Update function that is called anytime we need to trigger an update
	     * @returns { Object } - Stage
	     */
	  }, {
	    key: 'update',
	    value: function update() {
	      this.trigger('scroll', this.scrollTop);
	      this.tick = !this.tick;
	      return this;
	    }

	    /**
	     * Handle the resize event debouncing it
	     * @returns { Object } - Stage
	     */
	  }, {
	    key: 'resize',
	    value: function resize() {
	      var _this3 = this;

	      if (this.resizeTimer) clearTimeout(this.resizeTimer);
	      this.resizeTimer = setTimeout(function () {
	        return _this3.trigger('resize', _this3.size);
	      }, RESIZE_DELAY);
	      return this;
	    }

	    /**
	     * It returns the window scroll top position
	     * @returns { Number } - window offset top
	     */
	  }, {
	    key: 'scrollTop',
	    get: function get() {
	      var top = (window.pageYOffset || document.scrollTop) - (document.clientTop || 0);
	      return window.isNaN(top) ? 0 : top;
	    }

	    /**
	     * It returns the window height
	     * @returns { Number } - height of the viewport
	     */
	  }, {
	    key: 'height',
	    get: function get() {
	      return window.innerHeight;
	    }

	    /**
	     * It returns the window width
	     * @returns { Number } - width of the viewport
	     */
	  }, {
	    key: 'width',
	    get: function get() {
	      return window.innerWidth;
	    }

	    /**
	     * It returns the window size
	     * @returns { Object } - width and height of the viewport
	     */
	  }, {
	    key: 'size',
	    get: function get() {
	      return {
	        width: this.width,
	        height: this.height
	      };
	    }
	  }]);

	  return Stage;
	})();

	exports['default'] = Stage;
	module.exports = exports['default'];

/***/ },
/* 3 */
/***/ function(module, exports, __webpack_require__) {

	;(function(window, undefined) {var observable = function(el) {

	  /**
	   * Extend the original object or create a new empty one
	   * @type { Object }
	   */

	  el = el || {}

	  /**
	   * Private variables and methods
	   */

	  var callbacks = {},
	    onEachEvent = function(e, fn) { e.replace(/\S+/g, fn) }

	  /**
	   * Listen to the given space separated list of `events` and execute the `callback` each time an event is triggered.
	   * @param  { String } events - events ids
	   * @param  { Function } fn - callback function
	   * @returns { Object } el
	   */

	  el.on = function(events, fn) {
	    if (typeof fn != 'function')  return el

	    onEachEvent(events, function(name, pos) {
	      (callbacks[name] = callbacks[name] || []).push(fn)
	      fn.typed = pos > 0
	    })

	    return el
	  }

	  /**
	   * Removes the given space separated list of `events` listeners
	   * @param   { String } events - events ids
	   * @param   { Function } fn - callback function
	   * @returns { Object } el
	   */

	  el.off = function(events, fn) {
	    if (events == '*') callbacks = {}
	    else {
	      onEachEvent(events, function(name) {
	        if (fn) {
	          var arr = callbacks[name]
	          for (var i = 0, cb; cb = arr && arr[i]; ++i) {
	            if (cb == fn) arr.splice(i--, 1)
	          }
	        } else delete callbacks[name]
	      })
	    }
	    return el
	  }

	  /**
	   * Listen to the given space separated list of `events` and execute the `callback` at most once
	   * @param   { String } events - events ids
	   * @param   { Function } fn - callback function
	   * @returns { Object } el
	   */

	  el.one = function(events, fn) {
	    function on() {
	      el.off(events, on)
	      fn.apply(el, arguments)
	    }
	    return el.on(events, on)
	  }

	  /**
	   * Execute all callback functions that listen to the given space separated list of `events`
	   * @param   { String } events - events ids
	   * @returns { Object } el
	   */

	  el.trigger = function(events) {
	    var args = [].slice.call(arguments, 1)

	    onEachEvent(events, function(name) {

	      var fns = (callbacks[name] || []).slice(0)

	      for (var i = 0, fn; fn = fns[i]; ++i) {
	        if (fn.busy) return
	        fn.busy = 1
	        // avoid that this fn.busy gets stuck in case of errors it fixes #3
	        try {
	          fn.apply(el, fn.typed ? [name].concat(args) : args)
	        } catch (e) { /* error */}
	        if (fns[i] !== fn) { i-- }
	        fn.busy = 0
	      }

	      if (callbacks.all && name != 'all')
	        el.trigger.apply(el, ['all', name].concat(args))

	    })

	    return el
	  }

	  return el

	}  /* istanbul ignore next */
	  // support CommonJS, AMD & browser
	  if (true)
	    module.exports = observable
	  else if (typeof define === 'function' && define.amd)
	    define(function() { return observable })
	  else
	    window.observable = observable

	})(typeof window != 'undefined' ? window : undefined);

/***/ },
/* 4 */
/***/ function(module, exports, __webpack_require__) {

	/**
	 * This class will manage the parallax container
	 */

	'use strict';

	Object.defineProperty(exports, '__esModule', {
	  value: true
	});

	var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();

	function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

	function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }

	var _helpersHelpers = __webpack_require__(1);

	var _riotObservable = __webpack_require__(3);

	var _riotObservable2 = _interopRequireDefault(_riotObservable);

	/**
	 * Check the translate3d feature
	 */
	var HAS_TRANSLATE_3D = (function (div) {
	  (0, _helpersHelpers.prefix)(div.style, 'transform', 'translate3d(0, 0, 0)');
	  return (/translate3d/g.test(div.style.cssText)
	  );
	})(document.createElement('div'));

	var Canvas = (function () {
	  function Canvas(img, opts) {
	    _classCallCheck(this, Canvas);

	    // make this object observable
	    (0, _riotObservable2['default'])(this);
	    this.opts = opts;
	    this.img = img;
	    this.wrapper = img.parentNode;
	    this.isLoaded = false;
	  }

	  /**
	   * Load the image
	   * @returns { Object } - Canvas
	   */

	  _createClass(Canvas, [{
	    key: 'load',
	    value: function load() {
	      var _this = this;

	      if (!this.img.width || !this.img.width || !this.img.complete) this.img.onload = function () {
	        return _this.onImageLoaded();
	      };else this.onImageLoaded();

	      return this;
	    }

	    /**
	     * Callback triggered when the image gets loaded
	     * @returns { Object } - Canvas
	     */
	  }, {
	    key: 'onImageLoaded',
	    value: function onImageLoaded() {
	      this.isLoaded = true;
	      this.update();
	      this.trigger('loaded', this.img);
	      return this;
	    }

	    /**
	     * Center the image in its wrapper
	     * @returns { Object } - Canvas
	     */
	  }, {
	    key: 'update',
	    value: function update() {

	      var iw = this.img.naturalWidth || this.img.width,
	          ih = this.img.naturalHeight || this.img.height,
	          ratio = iw / ih,
	          size = this.size;

	      if (size.width / ratio <= size.height) {
	        this.img.height = size.height;
	        this.img.width = size.height * ratio;
	      } else {
	        this.img.width = size.width;
	        this.img.height = size.width / ratio;
	      }

	      this.img.style.top = - ~ ~((this.img.height - size.height) / 2) + 'px';
	      this.img.style.left = - ~ ~((this.img.width - size.width) / 2) + 'px';

	      return this;
	    }

	    /**
	     * Draw the image on the canvas
	     * @returns { Object } - Canvas
	     */
	  }, {
	    key: 'draw',
	    value: function draw(stage) {
	      var size = this.size,

	      // this value will be:
	      //  < 0 when the image is on the top
	      //  0 when the image is in the center of the screen
	      //  > 0 when the image is at the bottom
	      perc = (this.offset.top + size.height * this.opts.center + stage.height / 2 - stage.scrollTop) / stage.height - 1;
	      // increase the percentage effect according to the intensity
	      // and the current image height
	      perc *= this.img.height / size.height / 2 * this.opts.intensity;

	      if (HAS_TRANSLATE_3D) (0, _helpersHelpers.prefix)(this.img.style, 'transform', 'translate3d(0, ' + -perc + '%, 0)');else (0, _helpersHelpers.prefix)(this.img.style, 'transform', 'translate(0, ' + -perc + '%)');

	      return this;
	    }

	    /**
	     * Get the parent wrapper bounds
	     * @returns { Object } - parent tag bounds properties
	     */
	  }, {
	    key: 'bounds',
	    get: function get() {
	      return this.wrapper.getBoundingClientRect();
	    }

	    /**
	     * Get the parent wrapper offset
	     * @returns { Object } - top and left position of the image parent tag
	     */
	  }, {
	    key: 'offset',
	    get: function get() {
	      return {
	        top: this.wrapper.offsetTop,
	        left: this.wrapper.offsetLeft
	      };
	    }

	    /**
	     * Get the parent wrapper size
	     * @returns { Object } - the height and the width of the image parent tag
	     */
	  }, {
	    key: 'size',
	    get: function get() {
	      var props = this.bounds;
	      return {
	        height: props.height | 0,
	        width: props.width | 0
	      };
	    }
	  }]);

	  return Canvas;
	})();

	exports['default'] = Canvas;
	module.exports = exports['default'];

/***/ }
/******/ ])
});
;


text:
namespace subresource_filter {

namespace {

bool StartsWithFuzzyImpl(base::StringPiece text, base::StringPiece subpattern) {
  DCHECK_LE(subpattern.size(), text.size());

  for (size_t i = 0; i != subpattern.size(); ++i) {
    const char text_char = text[i];
    const char pattern_char = subpattern[i];
    if (text_char != pattern_char &&
        (pattern_char != kSeparatorPlaceholder || !IsSeparator(text_char))) {
      return false;
    }
  }
  return true;
}

}  // namespace

bool StartsWithFuzzy(base::StringPiece text, base::StringPiece subpattern) {
  return subpattern.size() <= text.size() &&
         StartsWithFuzzyImpl(text, subpattern);
}

bool EndsWithFuzzy(base::StringPiece text, base::StringPiece subpattern) {
  return subpattern.size() <= text.size() &&
         StartsWithFuzzyImpl(text.substr(text.size() - subpattern.size()),
                             subpattern);
}

}  // namespace subresource_filter


text:
module Hubspot
  #
  # HubSpot Owners API
  #
  # {http://developers.hubspot.com/docs/methods/owners/get_owners}
  #
  # TODO: Create an Owner
  # TODO: Update an Owner
  # TODO: Delete an Owner
  class Owner
    GET_OWNER_PATH    = '/owners/v2/owners/:owner_id' # GET
    GET_OWNERS_PATH   = '/owners/v2/owners' # GET
    CREATE_OWNER_PATH = '/owners/v2/owners' # POST
    UPDATE_OWNER_PATH = '/owners/v2/owners/:owner_id' # PUT
    DELETE_OWNER_PATH = '/owners/v2/owners/:owner_id' # DELETE

    attr_reader :properties, :owner_id, :email

    def initialize(property_hash)
      @properties = property_hash
      @owner_id   = @properties['ownerId']
      @email      = @properties['email']
    end

    def [](property)
      @properties[property]
    end

    class << self
      def all(include_inactive=false)
        path     = GET_OWNERS_PATH
        params   = { includeInactive: include_inactive }
        response = Hubspot::Connection.get_json(path, params)
        response.map { |r| new(r) }
      end

      def find(id, include_inactive=false)
        response = Hubspot::Connection.get_json(path, owner_id: id,
          include_inactive: include_inactive)
        new(response)
      end

      def find_by_email(email, include_inactive=false)
        path     = GET_OWNERS_PATH
        params   = { email: email, includeInactive: include_inactive }
        response = Hubspot::Connection.get_json(path, params)
        response.blank? ? nil : new(response.first)
      end

      def find_by_emails(emails, include_inactive=false)
        emails.map { |email| find_by_email(email, include_inactive) }.reject(&:blank?)
      end
    end
  end
end


text:
package com.sunzxy.frescopluslib.request.callback;

/**
 * Created by zhengxiaoyong on 16/1/12.
 */
public interface FPCacheCallback<T> {
    /**
     * @param result The result of the image was found in disk cache.
     */
    void onResult(T result);
}


text:
// @copyright 2017-2018 zzu_softboy <zzu_softboy@163.com>
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Created by softboy on 2017/08/04.

#include "zapi/kernel/Exception.h"
#include "zapi/kernel/OrigException.h"
#include "zapi/kernel/FatalError.h"
#include "zapi/kernel/NotImplemented.h"

namespace zapi
{
namespace kernel
{

Exception::Exception(std::string message)
   : m_message(std::move(message))
{}

Exception::~Exception()
{};

const char *Exception::what() const ZAPI_DECL_NOEXCEPT
{
   return m_message.c_str();
}

const std::string &Exception::getMessage() const ZAPI_DECL_NOEXCEPT
{
   return m_message;
}

long int Exception::getCode() const ZAPI_DECL_NOEXCEPT
{
   return -1;
}

const std::string &Exception::getFileName() const ZAPI_DECL_NOEXCEPT
{
   static std::string file{"<filename unknown>"};
   return file;
}

long int Exception::getLine() const ZAPI_DECL_NOEXCEPT
{
   return -1;
}

bool Exception::native() const
{
   return true;
}

bool Exception::report() const
{
   return false;
}

OrigException::OrigException(zend_object *object)
   : Exception(std::string{ZSTR_VAL(object->ce->name), ZSTR_LEN(object->ce->name)})
{
   // the result value from zend and the object zval
   zval result;
   zval properties;
   ZVAL_OBJ(&properties, object);
   // retrieve the message, filename, error code and line number
   auto message = zval_get_string(zend_read_property(Z_OBJCE(properties), &properties,
                                                     ZEND_STRL("message"), 1, &result));
   auto file = zval_get_string(zend_read_property(Z_OBJCE(properties), &properties, ZEND_STRL("file"), 1, &result));
   auto code = zval_get_long(zend_read_property(Z_OBJCE(properties), &properties, ZEND_STRL("code"), 1, &result));
   auto line = zval_get_long(zend_read_property(Z_OBJCE(properties), &properties, ZEND_STRL("line"), 1, &result));
   // store the message, code, filename and line number
   m_message.assign(ZSTR_VAL(message), ZSTR_LEN(message));
   m_code = code;
   m_file.assign(ZSTR_VAL(file), ZSTR_LEN(file));
   m_line = line;
   // clean up message and file strings
   zend_string_release(message);
   zend_string_release(file);
}

OrigException::OrigException(const OrigException &exception)
   : Exception("OrigException"),
     m_handled(exception.m_handled)
{}

OrigException::OrigException(OrigException &&exception)
   : Exception("OrigException"),
     m_handled(exception.m_handled)
{
   exception.m_handled = true;
}

OrigException::~OrigException() ZAPI_DECL_NOEXCEPT
{
   if (!m_handled) {
      return;
   }
   zend_clear_exception();
}

bool OrigException::native() const
{
   return false;
}

void OrigException::reactivate()
{
   // it was not handled by extension C++ code
   m_handled = false;
}

long int OrigException::getCode() const ZAPI_DECL_NOEXCEPT
{
   return m_code;
}

const std::string &OrigException::getFileName() const ZAPI_DECL_NOEXCEPT
{
   return m_file;
}

long int OrigException::getLine() const ZAPI_DECL_NOEXCEPT
{
   return m_line;
}

NotImplemented::NotImplemented()
   : std::exception()
{}

NotImplemented::~NotImplemented() ZAPI_DECL_NOEXCEPT
{}

/**
 * Constructor
 * @param  message
 */
FatalError::FatalError(const std::string &message)
   : Exception(message)
{}

FatalError::~FatalError()
{}

bool FatalError::native() const
{
   // although it is native, we return 0 because it should not persist
   // as exception, but it should live on as zend_error() in stead
   return false;
}

} // kernel
} // zapi


text:
CREATE OR REPLACE FUNCTION token(r resource, path text) RETURNS text[] AS $$
  WITH data as (SELECT unnest(jsonpath(r.content, path)) d),
       paths as (select (p->>'value')::text[] val, (p->>'namespace')::text[] ns, p->>'elements' elements FROM subpaths(r.type, path, 'token') p),
       subdata as (select unnest(jsonpath(d, elements)) d, val, ns from data, paths)
  SELECT array_agg(v) FROM (
       SELECT lower(d#>>val) FROM subdata
       union all
       SELECT COALESCE((lower(d#>>ns)), '') || '|' || (lower(d#>>val)) FROM subdata WHERE ns IS NOT NULL
  ) v(v)
$$ LANGUAGE SQL IMMUTABLE COST 1000;


text:
package uz.support.v14.app.index;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import uz.support.v14.R;
import uz.support.v14.collection.MyArray;
import uz.support.v14.widget.Section;
import uz.support.v14.widget.SessionAdapter;
import uz.support.v14.widget.ViewSetup;

public abstract class IndexSectionFragment extends IndexFragment {

    @Override
    protected ViewSetup onCreateViewSetup(LayoutInflater inflater, ViewGroup container) {
        return new ViewSetup(inflater, container, R.layout.i_list_layout);
    }

    public void setSections(MyArray<Section> sections) {
        SessionAdapter adapter = new SessionAdapter(getActivity(), sections);
        vsRoot.listView(R.id.list).setAdapter(adapter);
    }
}


text:
//
//  WLChallengeHandler.h
//  WorklightStaticLibProject
//
//  Created by Ishai Borovoy on 9/13/12.
//

#import "BaseChallengeHandler.h"
#import "WLFailResponse.h"

/**
 * @ingroup main
 * You use this base class to create a IBM Worklight Challenge Handler.
 * You must extend this class to implement your own version of an IBM Worklight Challenge Handler, for example RemoteDisableChallengeHandler.
 */
@interface WLChallengeHandler : BaseChallengeHandler
    /**
     * Send the answer back to the request.
     */
    -(void) submitChallengeAnswer: (NSDictionary *)answer;

	/**
    * This method is called when the Worklight Server reports an authentication success.
    */
    -(void) handleSuccess: (NSDictionary *)success;

    /**
    *  This method is called when the Worklight Server reports an authentication failure.
    */
    -(void) handleFailure: (NSDictionary *)failure;

    /**
    * This method is called when the Worklight Server returns a challenge for the realm.
    */
    -(void) handleChallenge: (NSDictionary *)challenge;
@end


text:
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace NodeApi.Neo4j {

    /// <summary>
    /// The class corresponding to a Neo4j path.
    /// </summary>
    [ScriptIgnoreNamespace]
    [ScriptImport]
    [ScriptName("Path")]
    public sealed class GraphPath {

        private GraphPath() {
        }

        /// <summary>
        /// The node that this path ends at.
        /// </summary>
        [ScriptField]
        public GraphNode End {
            get {
                return null;
            }
        }

        /// <summary>
        /// The length of this path
        /// </summary>
        [ScriptField]
        public int Length {
            get {
                return -1;
            }
        }

        /// <summary>
        /// The nodes that make up this path.
        /// </summary>
        [ScriptField]
        public List<GraphNode> Nodes {
            get {
                return null;
            }
        }

        /// <summary>
        /// The relationships that make up this path.
        /// </summary>
        [ScriptField]
        public List<GraphRelationship> Relationships {
            get {
                return null;
            }
        }

        /// <summary>
        /// The node that this path starts at.
        /// </summary>
        [ScriptField]
        public GraphNode Start {
            get {
                return null;
            }
        }
    }
}


text:
using namespace Xunit;
using namespace System;

namespace System { namespace Collections {
	/// <summary>
	/// IDictionaryTests
	/// </summary>
	public ref class IDictionaryTests
	{
	public:

	};
}}


text:
package noisecluster.test.specs.audio.render

import akka.actor.ActorSystem
import noisecluster.jvm.audio.Defaults
import noisecluster.jvm.audio.render.ByteStreamPlayer
import org.scalatest.{FlatSpec, Matchers}

import scala.concurrent.ExecutionContext
import scala.util.Random

class ByteStreamPlayerSpec extends FlatSpec with Matchers {
  private implicit val ec: ExecutionContext = ExecutionContext.Implicits.global
  private implicit val loggingSystem = ActorSystem("testLoggingSystem")
  private val format = Defaults.WasapiAudioFormat
  private val player = ByteStreamPlayer(format)
  private val testByteArraySize = 256 * format.getFrameSize

  "A ByteStreamPlayer" should "successfully start and render audio data" in {
    player.isActive should be(false)
    player.start()
    player.isActive should be(true)

    val bytes = Array.ofDim[Byte](testByteArraySize)
    Random.nextBytes(bytes)
    player.write(bytes, testByteArraySize)
  }

  it should "stop and restart rendering data" in {
    player.isActive should be(true)
    assertThrows[IllegalStateException] {
      player.start()
    }

    player.stop()
    player.isActive should be(false)

    assertThrows[IllegalStateException] {
      player.stop()
    }

    player.start()
    player.isActive should be(true)

    val bytes = Array.ofDim[Byte](testByteArraySize)
    Random.nextBytes(bytes)
    player.write(bytes, testByteArraySize)
  }

  it should "fail to close and active line" in {
    player.isActive should be(true)
    assertThrows[IllegalStateException] {
      player.close()
    }
    player.isActive should be(true)
  }

  it should "stop and close its line" in {
    player.isActive should be(true)
    player.stop()
    player.close()
    player.isActive should be(false)
  }
}


text:
def count_between(list_of_integers, lower_bound, upper_bound)
  if list_of_integers.empty? == true
    return 0
  end
  int = 0
  list_of_integers.each do |num|
    if num >= lower_bound && num <= upper_bound
      int = int+=1
    end
  end
  return int
end


text:
This is a header compression library for HTTP/2 (HPACK).
The library is developed under the specifications of the [HPACK draft-07](https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07).
The implementation is not entirely complete. See the *Missing features* section, to see what is missing to fulfill the draft.

## Usage
```rust
  extern crate collections;
  extern crate hpack;

  use collections::HashSet;
  use hpack::{HeaderField, Encoder, Decoder};

  fn main() {
      // Create a header set
      let mut header_set: ~HashSet<HeaderField> = ~HashSet::new();

      // Create two header fields
      let hf1: HeaderField = HeaderField::new(~":status", ~"200");
      let hf2: HeaderField = HeaderField::new(~"foo", ~"bar");

      // Insert the two header fields into the header set
      header_set.insert(hf1);
      header_set.insert(hf2);

      // Instantiate an encoder context and a decoder context
      let mut http2_encoder: Encoder = Encoder::new();
      let mut http2_decoder: Decoder = Decoder::new();

      // Encode the header set
      let encoded_header_set: ~[u8] = http2_encoder.encode(header_set);

      // Decode the just encoded header set
      let decoded_header_set: ~HashSet<HeaderField> = http2_decoder.decode(encoded_header_set).unwrap();
  }
```

## Rust versions
This library is developed using Rust 0.10.

## Missing features
- [x] Huffman encoding and decoding
- [ ] Change *header table size* of the encoding context

## Background
We are two students from the University of Copenhagen writing a bachelor thesis about designing and implementing an [HTTP/2](http://tools.ietf.org/html/draft-ietf-httpbis-http2-12) library in [Rust](http://www.rust-lang.org/). As a part of the project we have created this HPACK library. The goal of the project is not to make a complete implementation, but rather to focus on some specific chosen aspects. However, if it could be of any use to others, perhaps just as inspiration, that would be great.

Any feedback is welcome!

## Acknowledgement
Throughout the project, we got a little inspiration from [another HPACK implementation made by Jxck](https://github.com/Jxck/hpack), thank you!

## License
This library is dual licensed under the MIT license and the Apache license (version 2.0).
See LICENSE-APACHE and LICENSE-MIT for details.


text:
- `v::uploaded()`

Validates if the given data is a file that was uploaded via HTTP POST.

```php
v::uploaded()->validate('/path/of/an/uploaded/file'); // true
```

***
See also:

  * [Directory](Directory.md)
  * [Executable](Executable.md)
  * [Exists](Exists.md)
  * [Extension](Extension.md)
  * [File](File.md)
  * [Mimetype](Mimetype.md)
  * [Readable](Readable.md)
  * [Size](Size.md)
  * [SymbolicLink](SymbolicLink.md)
  * [Writable](Writable.md)


text:
Mock method and call original method with argument
--FILE--
<?php
class Foo
{
    private function bar($arg){}
}

require __DIR__ . '/../../../../vendor/autoload.php';

$class = new ReflectionClass('Foo');
$mockMethod = \PHPUnit\Framework\MockObject\MockMethod::fromReflection(
    $class->getMethod('bar'),
    true,
    false
);

$code = $mockMethod->generateCode();

print $code;
?>
--EXPECT--

private function bar($arg)
    {
        $__phpunit_arguments = [$arg];
        $__phpunit_count     = func_num_args();

        if ($__phpunit_count > 1) {
            $__phpunit_arguments_tmp = func_get_args();

            for ($__phpunit_i = 1; $__phpunit_i < $__phpunit_count; $__phpunit_i++) {
                $__phpunit_arguments[] = $__phpunit_arguments_tmp[$__phpunit_i];
            }
        }

        $this->__phpunit_getInvocationMocker()->invoke(
            new \PHPUnit\Framework\MockObject\Invocation\ObjectInvocation(
                'Foo', 'bar', $__phpunit_arguments, '', $this, false
            )
        );

        return call_user_func_array(array($this->__phpunit_originalObject, "bar"), $__phpunit_arguments);
    }


text:
hardware=`dmidecode -s system-product-name | grep -v '^#' | sed -e 's/\r//g' | sed -e 's/\n//g'`

# This is where Traffic Ops GenIso.pm writes disk.cfg.
# Well, more specifically it's where kickstart mounts
# what GenIso writes.
config_location='/mnt/stage2/ks_scripts/disk.cfg'

# This is the file that ks.cfg looks for (e.g what this script writes):
disk_config_loc='/tmp/drive_config'

boot_drives=''

if [ -e $config_location ]
then
    source $config_location
elif [ -e 'disk.cfg' ]
then
    source 'disk.cfg' # This is for testing outside of kickstart envs.
fi

boot_drives_old=$boot_drives
case $hardware in
    SSG-6047R-*)
    if [ "$boot_drives" == '' ]
    then
        boot_drives='sdb,sdc'
    fi
    first_drive=`echo $boot_drives | awk -F, ' { print $1 } '`
    second_drive=`echo $boot_drives | awk -F, ' { print $2 } '`

    cat <<EOF >> $disk_config_loc
# $hardware and $boot_drives_old
# Disk config
clearpart --all --initlabel --drives=$boot_drives
bootloader --location=mbr --driveorder=$boot_drives --append="crashkernel=auto"

ignoredisk --only-use=$boot_drives

part raid.boot.b --size=500 --ondisk=$first_drive
part raid.boot.c --size=500 --ondisk=$second_drive
part swap --size=2048 --ondisk=$first_drive
part swap --size=2048 --ondisk=$second_drive
part raid.root.b --size=1 --grow --ondisk=$first_drive
part raid.root.c --size=1 --grow --ondisk=$second_drive
raid /boot --fstype=ext4 --device=md0 --level=1 raid.boot.b raid.boot.c
raid / --fstype=ext4 --device=md1 --level=1 raid.root.b raid.root.c
EOF
;;
    *)
    if [ "$boot_drives" == "" ]
    then
        boot_drives='sda'
    fi
    cat <<EOF1 >> $disk_config_loc
# $hardware and $boot_drives_old
# Disk config
bootloader --location=mbr
clearpart --all --initlabel
zerombr yes
ignoredisk --only-use=$boot_drives
part /boot --fstype=ext4 --label=boot --size=500
part swap --size=4000
part / --fstype=ext4 --label=root --size=1 --grow
EOF1
;;
esac


text:
import { isBoolean } from "lodash";

import CountSpec from "./CountSpec";
import extractGroupPattern from "./extractGroupPattern";
import nextToken from "./nextPatternToken";

import { anyCharTestFn, digitTestFn } from "./patternTests";

/*
	Determines if a character is a matching/valid character for an edit mask pattern.

	Parameters:
		ch - the character to check
		pattern - the edit mask pattern
		pidx - index into the pattern
		countSpec - the CountSpec instance for the pattern

	Returns one of three values:
		true - yes
		false - no
		null - maybe but not this token (optional)
*/
export default function isValidPatternCharacter(ch, pattern, pidx, eatInvalid) {
	var checking;

	do {
// console.log(`Start loop: ch=${ch}, sym=${pattern[pidx]}, pattern=${pattern}, pidx=${pidx}`)
		switch(pattern[pidx]) {
			case '.':  // any characater
				var { result, nextIdx } = isValidCharacter(ch, pattern, pidx, eatInvalid, anyCharTestFn);
				break;
			case '(':  // capture group
				var { result, nextIdx } = isValidGroupCharacter(ch, pattern, pidx, eatInvalid);
				break;
			case 'd':  // digit
				var { result, nextIdx } = isValidCharacter(ch, pattern, pidx, eatInvalid, digitTestFn);
				break;
			default:   // literal
				var { result, nextIdx } = isValidLiteral(ch, pattern, pidx);
		}

		checking = eatInvalid ?result == null :result === undefined;

		// console.log(`isValidPatternCharacter(): sym=${pattern[pidx]}, ch=${ch}, pattern=${pattern}, ` +
		// 		`pidx=${pidx}, eatInvalid=${eatInvalid}, result=${result}, nextIdx=${nextIdx}, checking=${checking}`);

		pidx = nextIdx;
	} while (checking && pidx < pattern.length);

	return result === undefined ?null :result;
}

/**************************************************************************************************
	Helper functions for isValidPatternCharacter()
***************************************************************************************************/

export function isValidCharacter(nextCh, pattern, pidx, eatInvalid, testFn) {
	const valid = testFn(nextCh);

	if (valid) {
		// no need for nextIdx since done
		return { result: true };
	}

	const token = nextToken(pidx, pattern);
	const countSpec = new CountSpec(token);

	return {
		result: (countSpec.isOptionalToken() || eatInvalid) && null,  // false or null
		nextIdx: pidx + token.length,
	}
}

export function isValidGroupCharacter(ch, pattern, pidx, eatInvalid) {
	const groupMask = nextToken(pidx, pattern);
	const groupPattern = extractGroupPattern(groupMask);
// console.log(`isValidGroupCharacter() - ch=${ch}, groupPattern=${groupPattern}, groupMask=${groupMask}, ` +
// 		`pattern=${pattern}, pidx=${pidx}, valid=${valid}`)

	const valid = isValidPatternCharacter(ch, groupPattern, 0, eatInvalid);

	if (valid) {
		// no need for nextIdx since done
		return { result: valid }
	}

	const countSpec = new CountSpec(groupMask);

	return {
		result: countSpec.isOptionalToken() && null,  // false or null
		nextIdx: pidx + groupMask.length,
	}
}

export function isValidLiteral(ch, pattern, pidx) {
	const literalEscape = pattern[pidx] == '/';
	const sym = literalEscape ?pattern[pidx+1] :pattern[pidx];

// console.log(`isValidLiteral() - ch=${ch}, sym=${sym}, escape=${literalEscape}, valid=${ch === sym}`)
	if (ch === sym) {
		return { result: true }
	}

	const token = nextToken(pidx, pattern);

	return { nextIdx: pidx + token.length };
}


text:
This release adds some new parameters and also pins to rspec-puppet 1.x until migration.

####Features
- New parameters in `class xinetd`
  - `package_ensure`
  - `purge_confdir`
- New parameter in `xinetd::service`
  - `nice`

##2015-01-20 - Release 1.4.0
###Summary

This release adds support for Gentoo and improves FreeBSD support

####Features
- Gentoo support added
- Better defaults for group for FreeBSD
- Add deprecation warning for `$xtype` parameter

##2014-07-15 - Release 1.3.1
###Summary

This release merely updates metadata.json so the module can be uninstalled and
upgraded via the puppet module command.

##2014-06-18 - Release 1.3.0
####Features
- Add 'log_on_success', 'log_on_success_operator' and 'log_on_failure_operator
parameters to xinetd::service
- Add 'service_restart', 'service_status', 'service_hasrestart', and
'service_hasstatus' parameters to class xinetd.
- Add support for Amazon Linux.
- License changes to ASLv2
- Testing and documentation updates.

####Bugfixes
- Remove duplicated $log_on_failure parameter

##2013-07-30 - Release 1.2.0
####Features
- Add `confdir`, `conffile`, `package_name`, and `service_name` parameters to
`Class['xinetd']`
- Add support for FreeBSD and Suse.
- Add `log_on_failure`, `service_name`, `groups`, `no_access`, `access_times`,
`log_type`, `only_from`, and `xtype` parameters to `Xinetd::Service` define

####Bugfixes
- Redesign for `xinetd::params` pattern
- Add validation
- Add unit testing

##2012-06-07 - Release 1.1.0
- Add port and bind options to services
- make services deletable

##2010-08-12 - Release 1.0.1
-added documentation

##2010-06-24 - Release 1.0.0
- initial release