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

  angular.module('ez.fileTree', ['ez.object2array'])

  .constant('EzFileTreeConfig', {
    enableChecking: false, // show a checkbox beside each file
    enableFolderSelection: true, // allow folders to be selected
    enableFileSelection: true, // allow files to be selected
    multiSelect: false, // allow multiple files to be selected
    recursiveSelect: false, // recursively select a folders children
    recursiveUnselect: true, // recursively unselect a folders children
    icons: {
      chevronRight: 'fa fa-chevron-right',
      chevronDown: 'fa fa-chevron-down',
      folder: 'fa fa-folder',
      openFolder: 'fa fa-folder-open',
      file: 'fa fa-file'
    },
    childrenField: 'children', // the field name to recurse
    idField: 'id', // the files id field
    isFolder: function(file) { // function that checks if file is a folder
      return file.type === 'folder';
    },
    preSelect: false, // pre-select the passed in file/folder
    ancestorField: 'ancestors', // the field name that includes the ancestors of a file; required for pre-selection to work (format: flat, ordered array of folder objects with root folder being first, next folder down being second, and so forth)
    showRoot: false, // show the root folder in the file tree
    movingFolder: null // the id of folder being moved; neither it not any enclosed folder can be chosen
  })

  .directive('ezFileTree', [
    '$compile',
    '$timeout',
    '$parse',
    'EzFileTreeConfig',
    function(
      $compile,
      $timeout,
      $parse,
      EzFileTreeConfig
    ) {

    return {
      restrict: 'EA',
      replace: true,
      scope: {
        tree: '=ezFileTree',
        getChildren: '=?',
        config: '=?config'
      },
      templateUrl: 'ez-file-tree-container.html',
      compile: function(element, attrs) {
        // resolve config set in attrs
        var config = angular.extend({}, EzFileTreeConfig);
        for (var key in EzFileTreeConfig) {
          if (typeof attrs[key] !== 'undefined') {
            config[key] = $parse(attrs[key])();
          }
        }

        return function (scope) {
          scope.data = {
            showTree: false
          };

          var init = function() {
            scope.config = angular.extend(config, scope.config); // merge scope config with the rest of the config
            scope.disableSelect = false;

            var cachedSelectedFile = angular.extend({}, scope.tree._selectedFile);
            delete scope.tree._selectedFile;

            if (scope.config.showRoot) {
              var wrappedTree = {};

              wrappedTree[scope.config.idField] = 'root';
              wrappedTree.name = 'root';
              wrappedTree[scope.config.childrenField] = {};

              wrappedTree[scope.config.childrenField][scope.tree[scope.config.idField]] = $.extend(true, {}, scope.tree);
              wrappedTree[scope.config.childrenField][scope.tree[scope.config.idField]]._open = true;
              wrappedTree[scope.config.childrenField][scope.tree[scope.config.idField]].type = 'folder';

              scope.tree = wrappedTree;
            }

            if (scope.config.multiSelect) {
              scope.tree._selectedFiles = {};
            } else {
              scope.tree._selectedFile = null;
            }

            scope.tree._activeFiles = {};

            if (scope.tree[scope.config.childrenField]) {
              setParentOnChildren(scope.tree, true);

              if (scope.config.preSelect) {
                scope.findAndSelectFile(cachedSelectedFile);
              } else {
                scope.data.showTree = true;
              }
            }
          };

          scope.folderFindAndSelect = function(folder, file, ancestors) {
            if (ancestors.length > 1) {
              scope.recursiveFindAndSelect(folder, file, ancestors.slice(1));
            } else {
              for (var k in folder[scope.config.childrenField]) {
                var innerFolder = folder[scope.config.childrenField][k];

                if (k === file.id) {
                  select(innerFolder);

                  scope.data.showTree = true;

                  return;
                }
              }
            }
          };

          scope.recursiveFindAndSelect = function(parentFolder, file, ancestors) {
            var folder = parentFolder[scope.config.childrenField][ancestors[0][scope.config.idField]];

            if (!folder._open) {

              scope.toggle(null, folder, function(updatedFolder) {
                scope.folderFindAndSelect(updatedFolder, file, ancestors);
              });

            } else {
              scope.folderFindAndSelect(folder, file, ancestors);
            }
          };

          /**
           * Select pre-selected file (may require traversal to locate)
           *
           * @param {object} file A file object
           */
          scope.findAndSelectFile = function(file) {
            for (var k in scope.tree[scope.config.childrenField]) {
              var rootFolder = scope.tree[scope.config.childrenField][k];

              if (scope.config.ancestorField in file) {
                var ancestors = file[scope.config.ancestorField];

                if (ancestors.length === 0) {
                  if (k === file.id) {
                    select(rootFolder);

                    scope.data.showTree = true;

                    return;
                  }
                } else {
                  scope.recursiveFindAndSelect(scope.tree, file, ancestors);
                }
              }
            }
          };

          /**
           * Set parent reference on a file
           *
           * @param {object} file A file object
           * @param {boolean} recursive  Recurses child files if true
           */
          var setParentOnChildren = function(file, recursive) {
            for (var k in file[scope.config.childrenField]) {
              file[scope.config.childrenField][k]._parent = file;

              if (recursive && file[scope.config.childrenField][k][scope.config.childrenField]) {
                setParentOnChildren(file[scope.config.childrenField][k], true);
              }
            }
          };

          /**
           * Check if a folder has any files selected
           *
           * @param {object} file A file object
           * @return {boolean}
           */
          var hasChildrenSelected = function(file) {
            var selected = false;
            for (var key in file[scope.config.childrenField]) {
              if (file[scope.config.childrenField][key]._selected) {
                selected = true;
                break;
              } else if (file[scope.config.childrenField].files) {
                if (hasChildrenSelected(file[scope.config.childrenField])) {
                  selected = true;
                  break;
                }
              }
            }

            return selected;
          };

          /**
           * Set parent folders _active field to true
           *
           * @param {object} file A file object
           */
          var activate = function(file) {
            file._active = true;
            scope.tree._activeFiles[file[scope.config.idField]] = file;

            if (file._parent) {
              activate(file._parent);
            }
          };

          /**
           * Set a files _active property to false
           * set parents _active property as well if needed
           *
           * @params {object} file A file object
           */
          var deactivate = function(file) {
            var active = false;

            if (file[scope.config.childrenField] && hasChildrenSelected(file)) {
              active = true;
            }

            if (!active) {
              delete scope.tree._activeFiles[file[scope.config.idField]];
            }

            file._active = active;

            if (active === false && file._parent !== undefined) {
              deactivate(file._parent);
            }
          };

          /**
           * Recursively select a folders children
           *
           * @param {object} folder A folder object
           */
          var selectChildren = function(folder) {
            for (var key in folder[scope.config.childrenField]) {
              folder[scope.config.childrenField][key]._selected = true;
              folder[scope.config.childrenField][key]._active = true;

              if (scope.config.isFolder(folder[scope.config.childrenField][key])) {
                selectChildren(folder[scope.config.childrenField][key]);
              }
            }
          };

          /**
           * Deselects folder children's
           * @param f
           */
          var deselectChildren = function(f){
            for (var key in f[scope.config.childrenField]) {
              f[scope.config.childrenField][key]._selected = false;
              f[scope.config.childrenField][key]._active = false;

              if (scope.config.isFolder(f[scope.config.childrenField][key])) {
                deselectChildren(f[scope.config.childrenField][key]);
              }
            }
          };

          /**
           * Select a file
           *
           * @params {object} file A file object
           * @emits 'ez-file-tree.select' event
           */
          var select = function(file) {
            scope.$emit('ez-file-tree.select', file);
            if (!scope.config.enableFolderSelection && scope.config.isFolder(file)) { // don't allow folders to be selected
              return;
            }

            if (!scope.config.enableFileSelection && !scope.config.isFolder(file)) { // don't allow files to be selected
              return;
            }

            // cannot select a folder if that folder is being moved
            if (scope.config.movingFolder && scope.config.movingFolder.length && file[scope.config.idField] === scope.config.movingFolder) {
              return;
            }

            if (scope.config.multiSelect) {
              scope.tree._selectedFiles[file[scope.config.idField]] = file;
            } else {
              scope.tree._selectedFile = file;
              unselectAll(scope.tree[scope.config.childrenField]);
            }

            file._selected = true;

            activate(file);

            if (scope.config.recursiveSelect && scope.config.isFolder(file)) {
              selectChildren(file);
            }
          };

          /**
           * Unselect a file and deactivate recursively if needed
           *
           * @params {object} file A file object
           * @emits 'ez-file-tree.select' event
           */
          var unselect = function(file) {
            file._selected = false;

            scope.$emit('ez-file-tree.unselect', file);

            if (scope.config.multiSelect) {
              delete scope.tree._selectedFiles[file[scope.config.idField]];
            } else {
              scope.tree._selectedFile = null;
            }

            deactivate(file);

            if (scope.config.recursiveUnselect && scope.config.isFolder(file)) {
              deselectChildren(file);
            }
          };

          /**
           * Unselect all files in the tree
           *
           * @param {array} files An array of files to unselect
           * @emits 'ez-file-tree.unselect' event
           */
          var unselectAll = function(files) {
            for (var key in files) {
              if (typeof files[key][scope.config.childrenField] !== 'undefined') {
                unselectAll(files[key][scope.config.childrenField]);
              }
              files[key]._selected = false;
              scope.$emit('ez-file-tree.unselect', files[key]);
            }
          };

          /**
           * Opens/closes a folder
           *
           * @param {object}   e        A click event
           * @param {object}   file     A file object
           * @param {function} callback An optional callback function
           */
          scope.toggle = function(e, file, callback) {
            if (!scope.config.isFolder(file)) {
              return;
            }

            // cannot open/close a folder if that folder is being moved
            if (scope.config.movingFolder && scope.config.movingFolder.length && file[scope.config.idField] === scope.config.movingFolder) {
              return;
            }

            if (e) { // wait for possible dbl click
              scope.disableSelect = true;
              $timeout(function() {
                scope.disableSelect = false;
              }, 500);
            }

            file._open = !file._open;

            if (!file[scope.config.childrenField] || (file[scope.config.childrenField] && !file[scope.config.childrenField].length)) {
              if (typeof scope.getChildren === 'undefined') {
                throw new Error('You must add a getChildren method to the directive scope or hard code a children field on your folder objects.');
              }

              scope.getChildren(file).then(function(children) { // call getChildren method that the user has defined
                for (var key in children) {
                  children[key]._parent = file;

                  if (scope.config.multiSelect) {
                    if (typeof scope.tree._selectedFiles[children[key][scope.config.idField]] !== 'undefined') {
                      children[key]._selected = true;
                    }
                  } else {
                    if (scope.tree._selectedFile && scope.tree._selectedFile[scope.config.idField] === children[key][scope.config.idField]) {
                      children[key]._selected = true;
                    }
                  }
                }

                file[scope.config.childrenField] = children;

                if (callback) {
                  callback(file);
                }
              });
            }
          };

          /**
           * Checks if a checkbox should be shown
           *
           * @param {object} file A file object
           * @returns {boolean}
           */
          scope.showCheckbox = function(file) {
            if (!scope.config.enableChecking || (scope.config.isFolder(file) && !config.enableFolderSelection)) {
              return false;
            }

            return true;
          };

          /**
           * Toggle selection of an file
           *
           * @param {object} e A click event
           * @param {object} file A file object
           */
          scope.select = function(e, file) {
            e.preventDefault();
            $timeout(function() {
              if (scope.disableSelect === true) {
                return;
              }
              scope.disableSelect = false;

              if (!file._selected) {
                select(file);
              } else {
                unselect(file);
              }
            }, 200);
          };

          init();
        };
      }
    };
  }]);
})( angular );


text:
//
// sbt-pom-plugin - Makes Maven project metadata usable from SBT
// http://github.com/samskivert/sbt-pom-plugin

package samskivert

import java.io.File
import scala.io.Source

import sbt._
import sbt.Keys._

import pomutil.{POM, Dependency}

/** Now an implementation detail, see [MavenBuild] for multi-module projects. */
class ProjectBuilder (rootPom :File) {

  /** Defines extra settings that are applied to all projects. */
  def globalSettings :Seq[Setting[_]] = Nil

  /** Defines extra settings for the module named `name`.
   * @param pom the POM for the module in question. */
  def moduleSettings (name :String, pom :POM) :Seq[Setting[_]] = Nil

  /** Returns SBT projects for sub-modules in this project.
    * @param profiles the Maven profiles to consider "active" when enumerating sub-modules.
    * Pass `Seq("*")` to consider all profiles active. */
  def projects (profiles :Seq[String]) :Seq[Project] = {
    val modules = profiles match {
      case Seq()    => POMUtil.expandModules(_modules, _pom, _.modules)
      case Seq("*") => POMUtil.expandModules(_modules, _pom, _.allModules)
      case ps       => POMUtil.expandModules(_modules, _pom, p => ps.flatMap(p.modules).distinct)
    }
    modules.map(apply) :+ root(modules)
  }

  /** Creates an SBT project for the specified sub-module. You probably want to use `root` +
    * `projects` and have projects automatically created, but this is here for special needs. */
  def apply (name :String) :Project = {
    val (pom, pomFile) = _modules.getOrElse(name, sys.error("No sub-module POM in " + name + "."))
    val (locdeps, odeps) = pom.depends.partition(isLocal)
    val msettings = baseSettings(pom) ++ moduleSettings(name, pom) ++ Seq(
      libraryDependencies ++= odeps.map(POMUtil.toIvyDepend)
    )
    // create the project, and apply all of the sibling dependencies
    (Project(name, pomFile.getParentFile, settings = msettings) /: locdeps) {
      case (p, dep) => p dependsOn(projectRef(dep) % (dep.scope + "->compile"))
    }
  }

  /** Returns true if the specified project is managed by this builder. */
  private def isLocal (depend :Dependency) :Boolean =
    _depToModule.contains(depend.id) || _builders.exists(_.isLocal(depend))

  /** Returns the SBT project reference for the supplied POM dependency.
    * Requires that `depend` has already been confirmed as local by `isLocal`. */
  private def projectRef (depend :Dependency) :ProjectReference =
    if (_depToModule.contains(depend.id)) ProjectRef(_root.toURI, _depToModule(depend.id))
    else _builders.find(_.isLocal(depend)).map(_.projectRef(depend)).get

  /** Creates a root project with settings from the top-level POM which aggregates `modules`. */
  private def root (modules :Seq[String]) :Project = Project(
    _pom.artifactId, _root, settings = baseSettings(_pom)).
    aggregate(modules.map(LocalProject) :_*)

  private def baseSettings (pom :POM) =
    Defaults.defaultSettings ++ POMUtil.pomToSettings(pom, true) ++ globalSettings

  private val _root = rootPom.getParentFile match {
    case null => file(".")
    case f => f
  }
  private val _pom = POM.fromFile(rootPom).getOrElse(sys.error("Unable to load POM from " + rootPom))
  private val _modules :Map[String, (POM,File)] = POMUtil.resolveModules(_pom)
  private val _depToModule :Map[String,String] = _modules.map(t => (t._2._1.id, t._1))

  private val _builders :Seq[ProjectBuilder] = try {
    val workFile = new File(_root, ".workspace")
    if (!workFile.exists) Seq()
    else Source.fromFile(workFile).getLines.toSeq.map(p => new File(p)).collect {
      case root if (root.isDirectory) => new File(root, "pom.xml")
      case root if (root.isFile) => root
    }.map(root => new ProjectBuilder(root))
  } catch {
    case e :Throwable => e.printStackTrace(System.err) ; Seq()
  }
}

redpajama_set_name: RedPajamaGithub


text:
/*
 * Your rights to use code governed by this license https://github.com/AlexWan/OsEngine/blob/master/LICENSE
 * Ваши права на использование кода регулируются данной лицензией http://o-s-a.net/doc/license_simple_engine.pdf
*/

using System;
using System.Globalization;
using System.Windows;
using OsEngine.Language;
using OsEngine.OsTrader.Panels;

namespace OsEngine.Robots.Trend
{
    public partial class MomentumMacdUi
    {
        private MomentumMacd _strategy;
        public MomentumMacdUi(MomentumMacd strategy)
        {
            InitializeComponent();
            _strategy = strategy;

            TextBoxVolumeOne.Text = _strategy.VolumeFix.ToString();

            TextBoxSlipage.Text = _strategy.Slipage.ToString(new CultureInfo("ru-RU"));
            ComboBoxRegime.Items.Add(BotTradeRegime.Off);
            ComboBoxRegime.Items.Add(BotTradeRegime.On);
            ComboBoxRegime.Items.Add(BotTradeRegime.OnlyClosePosition);
            ComboBoxRegime.Items.Add(BotTradeRegime.OnlyLong);
            ComboBoxRegime.Items.Add(BotTradeRegime.OnlyShort);
            ComboBoxRegime.SelectedItem = _strategy.Regime;

            LabelRegime.Content = OsLocalization.Trader.Label115;
            LabelVolume.Content = OsLocalization.Trader.Label30;
            LabelSlippage.Content = OsLocalization.Trader.Label92;
            ButtonAccept.Content = OsLocalization.Trader.Label17;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {

                if (Convert.ToDecimal(TextBoxVolumeOne.Text) <= 0 ||
                    Convert.ToDecimal(TextBoxSlipage.Text) < 0)
                {
                    throw new Exception("");
                }

            }
            catch (Exception)
            {
                MessageBox.Show(OsLocalization.Trader.Label13);
                return;
            }

            _strategy.VolumeFix = Convert.ToDecimal(TextBoxVolumeOne.Text);
            _strategy.Slipage = Convert.ToDecimal(TextBoxSlipage.Text);
            Enum.TryParse(ComboBoxRegime.Text, true, out _strategy.Regime);

            _strategy.Save();
            Close();
        }
    }
}


text:
require 'spec_helper'

describe Glass::Config do

  context 'default values' do

    describe '#reset' do

      it 'responds to default app name' do
        Glass::Config.app_name = 'Dummy'
        Glass::Config.reset

        expect(Glass::Config.app_name).to eq('')
        expect(Glass::Config.app_name).to_not eq('Dummy')
      end

      it 'responds to default mounted route' do
        Glass::Config.mounted_at = '/dummy'
        Glass::Config.reset

        expect(Glass::Config.mounted_at).to eq('/api')
        expect(Glass::Config.mounted_at).to_not eq('/dummy')
      end

      it 'responds to default models' do
        Glass::Config.models = ['Pete', 'Robbie', 'Joko']
        Glass::Config.reset

        expect(Glass::Config.models).to eq([])
        expect(Glass::Config.models).to_not eq(['Pete', 'Robbie', 'Joko'])
      end

      it 'responds to default format' do
        Glass::Config.format = :xml
        Glass::Config.reset

        expect(Glass::Config.format).to eq(:json)
        expect(Glass::Config.format).to_not eq(:xml)
      end

      it 'responds to default routes' do
        Glass::Config.models = ['Pete', 'Robbie', 'Joko']
        Glass::Config.routes = Glass::Config.setup
        Glass::Config.reset

        expect(Glass::Config.routes).to eq({})
        expect(Glass::Config.routes).to_not eq(Glass::Config.setup)
      end

    end
  end

  describe '#models_with_routes' do

    before :each do
      Glass::Config.models = %w{Pete Robbie Joko}
      Glass::Config.models_with_routes
    end

    it 'creates routes from the inputted models' do
      expect(Glass::Config.routes).to_not be_nil
    end

    context 'CRUD' do

      it 'creates #index' do
        index_route = Glass::Config.routes[:pete]['index']

        expect(index_route).to_not be_nil
      end

      it 'creates #show' do
        show_route = Glass::Config.routes[:pete]['show']

        expect(show_route).to_not be_nil
      end

      it 'creates #create' do
        create_route = Glass::Config.routes[:pete]['create']

        expect(create_route).to_not be_nil
      end

      it 'creates #update' do
        update_route = Glass::Config.routes[:pete]['update']

        expect(update_route).to_not be_nil
      end

      it 'creates #destroy' do
        destroy_route = Glass::Config.routes[:pete]['destroy']

        expect(destroy_route).to_not be_nil
      end

    end

  end

  describe '#setup' do

    it 'calls the #models_with_routes method' do
      Glass::Config.should_receive(:models_with_routes)

      Glass::Config.setup
    end
  end

  context 'Utility methods' do

    describe '#pluralize_downcase(model)' do

      it 'pluralizes then downcases a string' do
        expect(Glass::Config.pluralize_downcase('Fly')).to eq('flies')
        expect(Glass::Config.pluralize_downcase('User')).to eq('users')
      end

    end

    describe '#capitalize_singularize(model)' do

      it 'capitalizes then singularizes a string' do
        expect(Glass::Config.capitalize_singularize('flies')).to eq('Fly')
        expect(Glass::Config.capitalize_singularize('users')).to eq('User')
      end
    end

  end

end


text:
<?php

/**
 * $Header: /home/ppcvs/paypal_php_sdk/Log/syslog.php,v 1.1 2006/02/19 08:22:29 dennis Exp $
 * $Horde: horde/lib/Log/syslog.php,v 1.6 2000/06/28 21:36:13 jon Exp $
 *
 * @version $Revision: 1.1 $
 * @package Log
 */

/**
 * The Log_syslog class is a concrete implementation of the Log::
 * abstract class which sends messages to syslog on UNIX-like machines
 * (PHP emulates this with the Event Log on Windows machines).
 *
 * @author  Chuck Hagenbuch <chuck@horde.org>
 * @since   Horde 1.3
 * @since   Log 1.0
 * @package Log
 *
 * @example syslog.php      Using the syslog handler.
 */
class Log_syslog extends Log
{
    /**
    * Integer holding the log facility to use.
    * @var string
    * @access private
    */
    var $_name = LOG_SYSLOG;

    /**
     * Constructs a new syslog object.
     *
     * @param string $name     The syslog facility.
     * @param string $ident    The identity string.
     * @param array  $conf     The configuration array.
     * @param int    $level    Log messages up to and including this level.
     * @access public
     */
    function Log_syslog($name, $ident = '', $conf = array(),
                        $level = PEAR_LOG_DEBUG)
    {
        /* Ensure we have a valid integer value for $name. */
        if (empty($name) || !is_int($name)) {
            $name = LOG_SYSLOG;
        }

        $this->_id = md5(microtime());
        $this->_name = $name;
        $this->_ident = $ident;
        $this->_mask = Log::UPTO($level);
    }

    /**
     * Opens a connection to the system logger, if it has not already
     * been opened.  This is implicitly called by log(), if necessary.
     * @access public
     */
    function open()
    {
        if (!$this->_opened) {
            openlog($this->_ident, LOG_PID, $this->_name);
            $this->_opened = true;
        }

        return $this->_opened;
    }

    /**
     * Closes the connection to the system logger, if it is open.
     * @access public
     */
    function close()
    {
        if ($this->_opened) {
            closelog();
            $this->_opened = false;
        }

        return ($this->_opened === false);
    }

    /**
     * Sends $message to the currently open syslog connection.  Calls
     * open() if necessary. Also passes the message along to any Log_observer
     * instances that are observing this Log.
     *
     * @param mixed $message String or object containing the message to log.
     * @param int $priority (optional) The priority of the message.  Valid
     *                  values are: PEAR_LOG_EMERG, PEAR_LOG_ALERT,
     *                  PEAR_LOG_CRIT, PEAR_LOG_ERR, PEAR_LOG_WARNING,
     *                  PEAR_LOG_NOTICE, PEAR_LOG_INFO, and PEAR_LOG_DEBUG.
     * @return boolean  True on success or false on failure.
     * @access public
     */
    function log($message, $priority = null)
    {
        /* If a priority hasn't been specified, use the default value. */
        if ($priority === null) {
            $priority = $this->_priority;
        }

        /* Abort early if the priority is above the maximum logging level. */
        if (!$this->_isMasked($priority)) {
            return false;
        }

        /* If the connection isn't open and can't be opened, return failure. */
        if (!$this->_opened && !$this->open()) {
            return false;
        }

        /* Extract the string representation of the message. */
        $message = $this->_extractMessage($message);

        if (!syslog($this->_toSyslog($priority), $message)) {
            return false;
        }

        $this->_announce(array('priority' => $priority, 'message' => $message));

        return true;
    }

    /**
     * Converts a PEAR_LOG_* constant into a syslog LOG_* constant.
     *
     * This function exists because, under Windows, not all of the LOG_*
     * constants have unique values.  Instead, the PEAR_LOG_* were introduced
     * for global use, with the conversion to the LOG_* constants kept local to
     * to the syslog driver.
     *
     * @param int $priority     PEAR_LOG_* value to convert to LOG_* value.
     *
     * @return  The LOG_* representation of $priority.
     *
     * @access private
     */
    function _toSyslog($priority)
    {
        static $priorities = array(
            PEAR_LOG_EMERG   => LOG_EMERG,
            PEAR_LOG_ALERT   => LOG_ALERT,
            PEAR_LOG_CRIT    => LOG_CRIT,
            PEAR_LOG_ERR     => LOG_ERR,
            PEAR_LOG_WARNING => LOG_WARNING,
            PEAR_LOG_NOTICE  => LOG_NOTICE,
            PEAR_LOG_INFO    => LOG_INFO,
            PEAR_LOG_DEBUG   => LOG_DEBUG
        );

        /* If we're passed an unknown priority, default to LOG_INFO. */
        if (!is_int($priority) || !in_array($priority, $priorities)) {
            return LOG_INFO;
        }

        return $priorities[$priority];
    }

}


text:
.. _framework:

Modeling Framework
==================

This section explains the design of the xarray-simlab modeling
framework. It is useful mostly for users who want to create new models
from scratch or customize existing models. Users who only want to run
simulations from existing models may skip this section.

For more practical details on how using the API to create, inspect and
run models, see the relevant sections of this user guide.

Main concepts
-------------

The xarray-simlab framework is built on a very few concepts that
allow great flexibility in model customization:

- models
- processes
- variables

These are detailed here below.

Models
------

Models are instances of the :class:`~xsimlab.Model` class. They
consist of ordered, immutable collections of processes. The
ordering is inferred automatically from the given processes (see below).

The Model class also implements specific methods for:

- introspection,
- running simulations,
- easy creation of new Model objects from existing ones by dropping,
  adding or replacing one or more processes.

Processes
---------

Processes are defined as Python classes that are decorated by
:func:`~xsimlab.process`. The role of a process is twofold:

- declare a given subset of the variables used in a model,
- define a specific set of instructions that use or compute values for
  these variables during a model run.

Conceptually, a process is a logical component of a computational
model. It may for example represent a particular physical mechanism
that is described in terms of one or more state variables (e.g.,
scalar or vector fields) and one or more operations -- with or without
parameters -- that modify those state variables through time. Note
that some processes may be time-independent or may even be used to
declare variables without implementing any computation.

.. note::

   xarray-simlab does not provide any built-in logic for tasks like
   generating computational meshes or setting boundary conditions,
   which should rather be implemented in 3rd-party libraries as
   processes. Even those tasks may be too specialized to justify
   including them in this framework, which aims to be as general as
   possible.

A process-ified class behaves mostly like any other regular Python
class, i.e., there is a-priori nothing that prevents you from using
the common object-oriented features as you like. The only difference
is that you can here create classes in a very succinct way without
boilerplate, i.e., you don't need to implement dunder methods like
``__init__`` or ``__repr__`` as this is handled by the framework. In
fact, this framework uses and extends the attrs_ package:
:func:`~xsimlab.process` is a wrapper around :func:`attr.s` and the
functions used to create variables (see below) are thin wrappers
around :func:`attr.ib`.

.. _attrs: http://www.attrs.org

Variables
---------

Variables are the most basic elements of a model. They are declared in
processes as class attributes, using :func:`~xsimlab.variable`.
Declaring variables mainly consists of defining useful metadata such
as:

- labeled dimensions (or no dimension for scalars),
- predefined meta-data attributes, e.g., a short description,
- user-defined meta-data attributes, e.g., units or math symbol,
- the intent for a variable, i.e., whether the process
  needs (``intent='in'``), updates (``intent='inout'``) or computes
  (``intent='out'``) a value for that variable.

It is also possible to set a default value as well as value validator(s).
See `attrs' validators`_ for more details.

.. note::

   xarray-simlab does not distinguish between model parameters, input
   and output variables. All can be declared using
   :func:`~xsimlab.variable`.

.. _`attrs' validators`: https://www.attrs.org/en/stable/examples.html#validators

Foreign variables
~~~~~~~~~~~~~~~~~

Like different physical mechanisms involve some common state variables
(e.g., temperature or pressure), different processes may operate on
common variables.

In xarray-simlab, a variable is declared at a unique place, i.e.,
within one and only one process. Using common variables across
processes is achieved by declaring :func:`~xsimlab.foreign`
variables. These are simply references to variables that are declared
in other processes.

You can use foreign variables for almost any computation inside a
process just like original variables. The only difference is that
``intent='inout'`` is not supported for a foreign variable, i.e., a
process may either need or compute a value of a foreign variable but
may not update it (otherwise it would not be possible to unambiguously
determine process dependencies -- see below). For the same reason,
only one process in a model may compute a value of a variable (i.e.,
``intent='out'``).

The great advantage of declaring variables at unique places is that all their
meta-data are defined once. However, a downside of this approach is that foreign
variables may potentially add many hard-coded links between processes, which
makes harder reusing these processes independently of each other. Global and/or
group variables may circumvent those hard-coded link.

Global variables
~~~~~~~~~~~~~~~~

Like foreign variables, global variables can be used for accessing (read / write)
common variables in multiple processes. Unlike foreign variables, linking global
variables is implicit and only based on their "global name", which must identify
it unambiguously in a model.

Most variables in xarray-simlab accept a ``global_name`` argument. References to
these variables can be declared in other processes using
:func:`~xsimlab.global_ref`. Those references are resolved when creating new a
:class:`~xsimlab.Model` object. Xarray-simlab also implements some safe-guards
against possible inconsistencies in a model (i.e., unresolved global names or
name conflicts).

Global variables are a good alternative to foreign variables in the presence of
naming standards. It may increase the potential to reuse process classes and
build more flexible model structures. One major limitation, however, is that
variable metadata (e.g., description, dimensions, etc.) is not known for
:func:`~xsimlab.global_ref` declarations until a model is created, which limits
introspection of the processes taken individually.

Group variables
~~~~~~~~~~~~~~~

In some cases, using group variables may provide an elegant alternative to
hard-coded links between processes.

The membership of variables to one or several groups is defined via their
``groups`` attribute. If you want to reuse in a separate process all the
variables of a given group, instead of explicitly declaring each of them as
foreign variables you can simply declare a :func:`~xsimlab.group` (or
:func:`~xsimlab.group_dict`) variable. The latter behaves like an iterable (or
mapping) of foreign variables pointing to each of the variables (model-wise)
that are members of the same group.

Note that group variables implicitly have ``intent='in'``, i.e, they could only
be used to get the values of multiple foreign variables, not set their values.

Group variables are useful particularly in cases where you want to combine
(aggregate) different processes that act on the same variable, e.g. in landscape
evolution modeling combine the effect of different erosion processes on the
evolution of the surface elevation. This way you can easily add or remove
processes to/from a model and avoid missing or broken links between processes.

On-demand variables
~~~~~~~~~~~~~~~~~~~

On-demand variables are like regular variables, except that their
value is not intended to be computed systematically, e.g., at the
beginning or at each time step of a simulation, but instead only at a
given few times (or not at all). These are declared using
:func:`~xsimlab.on_demand` and must implement in the same
process-ified class a dedicated method -- i.e., decorated with
``@foo.compute`` where ``foo`` is the name of the variable -- that
returns their value. They implicitly have ``intent='out'``.

On-demand variables are useful, e.g., for optional model diagnostics.

Index variables
~~~~~~~~~~~~~~~

Index variables are intended for indexing data of other variables in a model
like, e.g., coordinate labels of grid nodes. They are declared using
:func:`~xsimlab.index`. They implicitly have ``intent='out'``, although their
values could be computed from other input variables.

'Object' variables
~~~~~~~~~~~~~~~~~~

Sometimes we need to share between processes one or more arbitrary objects,
e.g., callables or instances of custom classes that have no array-like
interface. Those objects should be declared in process-decorated classes using
:func:`~xsimlab.any_object`.

Within a model, those 'object' variables are reserved for internal use only,
i.e., they never require an input value (they implicitly have ``intent='out'``)
and they can't be saved as outputs as their value may not be compatible with the
xarray data model. Of course, it is still possible to create those objects using
data from other (input) variables declared in the process. Likewise, their data
could still be coerced into a scalar or an array and be saved as output via
another variable.

Simulation workflow
-------------------

A model run is divided into four successive stages:

1. initialization
2. run step
3. finalize step
4. finalization

During a simulation, stages 1 and 4 are run only once while stages 2 and 3 are
repeated for a given number of (time) steps. Stage 4 is always run even when an
exception is raised during stage 1, 2 or 3.

Each :func:`~xsimlab.process` decorated class may provide its own computation
instructions by implementing specific "runtime" methods named ``.initialize()``,
``.run_step()``, ``.finalize_step()`` and ``.finalize()`` for each stage above,
respectively. Note that this is entirely optional. For example, time-independent
processes (e.g., for setting model grids) usually implement stage 1 only. In a
few cases, the role of a process may even consist of just declaring some
variables that are used elsewhere.

Runtime methods may be decorated by :func:`~xsimlab.runtime`. This is useful if
one needs to access the value of some runtime-specific variables like the
current step, time step duration, etc. from within those methods. Runtime
methods may also return a :func:`~xsimlab.RuntimeSignal` to control the
workflow, e.g., break the execution of the current stage.

It is also possible to monitor and/or control simulations independently of any
model, using runtime hooks. See Section :ref:`monitor`.

Get / set variable values inside a process
------------------------------------------

Once you have declared a variable as a class attribute in a process, you can
further get and/or set its value like a regular instance attribute. For example,
if you declare a variable ``foo`` you can just use ``self.foo`` to get/set its
value inside one method of that class.

Additionally, the :func:`~xsimlab.process` decorator takes all variables
declared as class attributes and turns them into properties, which may be
read-only depending on the ``intent`` set for the variables. For all variables
except on-demand variables, the getter/setter methods of those properties
read/write values via a simple dictionary that is common to a simulation. Note
that those properties are created only for the case where a ``process``
decorated class is used within a ``Model`` object.

Process dependencies and ordering
---------------------------------

The order in which processes are executed during a simulation is
critical. For example, if the role of a process is to compute a value
for a given variable, then the execution of this process must happen
before the execution of all other processes that use the same variable
in their computation.

In a model, the processes and their dependencies together form the
nodes and the edges of a Directed Acyclic Graph (DAG). The graph
topology is fully determined by the ``intent`` set for each variable
or foreign variable declared in each process. An ordering that is
computationally consistent can then be obtained using topological
sorting. This is done at Model object creation. The same ordering is
used at every stage of a model run.

The DAG structure also allows running the processes in parallel at every stage
of a model run, see Section :ref:`run_parallel_single`.

Model inputs
------------

In a model, inputs are variables that need a value to be set by the
user before running a simulation.

Like process ordering, inputs are automatically retrieved at Model
object creation by looking at the ``intent`` set for all variables and
foreign variables in the model. A variable is a model input if it has
``intent`` set to ``'in'`` or ``'inout'`` and if it has no linked
foreign variable with ``intent='out'``.


text:
package fr.openwide.core.test.jpa.more.elasticsearch;

import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;

import fr.openwide.core.jpa.config.spring.provider.IJpaConfigurationProvider;
import fr.openwide.core.jpa.search.service.IHibernateSearchService;
import fr.openwide.core.jpa.util.EntityManagerUtils;
import fr.openwide.core.test.jpa.more.business.AbstractJpaMoreTestCase;
import fr.openwide.core.test.jpa.more.business.entity.model.TestEntity;

public class TestElasticSearch extends AbstractJpaMoreTestCase {

	@Autowired
	protected EntityManagerUtils entityManagerUtils;

	@Autowired
	protected IJpaConfigurationProvider configurationProvider;

	@Autowired
	private IHibernateSearchService hibernateSearchService;

	/**
	 * Check that elasticsearch analyzers can be mapped to Lucene ones.
	 */
	@Test
	public void testElasticSearchAnalyzer() {
		hibernateSearchService.getAnalyzer(TestEntity.class);
	}

}


text:
import {Component, Output, Input, EventEmitter, Inject, Optional, forwardRef, ElementRef, AfterContentInit} from "@angular/core";
import 'rxjs/add/operator/share';
import 'rxjs/add/operator/map';
import {MdCheckbox} from "@angular2-material/checkbox";
import {MdDataTable} from './data_table';

/**
 * MdDataTable row
 */
export interface ITableSelectableRow {
  selectableValue: string;
  onChange: EventEmitter<ITableSelectableRowSelectionChange>;
  isActive: boolean;
  change: (event: any) => void;
  ngAfterContentInit: () => void;
}

/**
 * Selectable change event data
 */
export interface ITableSelectableRowSelectionChange {
  name: string;
  target: ITableSelectableRow;
  isActive: boolean;
  selectableValue: string;
}

export abstract class AbstractMdDataTableSelectableRow implements AfterContentInit, ITableSelectableRow {
  @Input('selectable-value')
  selectableValue: string;
  @Output()
  onChange: EventEmitter<ITableSelectableRowSelectionChange> = new EventEmitter(false);
  isActive: boolean = false;

  constructor(@Optional()
              @Inject(forwardRef(() => MdDataTable))
              public table: MdDataTable, protected _element: ElementRef) {
    this.onChange.share();
  }

  /**
   * Change active status
   */
  change(event) {
    if (event.target.classList.contains('md-checkbox-inner-container')) {
      event.preventDefault();
    }

    this.isActive = !this.isActive;

    let changeEvent: ITableSelectableRowSelectionChange = {
      name: 'selectable_row_change',
      target: this,
      isActive: this.isActive,
      selectableValue: this.selectableValue
    }
    this.onChange.emit(changeEvent);
  }

  ngAfterContentInit() {}
}

@Component({
  selector: 'tr[md-data-table-header-selectable-row]',
  template: `

            <md-checkbox [checked]="isActive"></md-checkbox>

        <ng-content></ng-content>
    `,
  directives: [MdCheckbox],
  host: {
    '[class.active]': 'isActive',
    '(click)': 'change($event)'
  }
})
export class MdDataTableHeaderSelectableRow extends AbstractMdDataTableSelectableRow {
  constructor(@Optional()
              @Inject(forwardRef(() => MdDataTable))
              public table: MdDataTable, protected _element: ElementRef) {
    super(table, _element);
  }

  _bindListener(): void {
    this.table.onSelectableChange
      .map(event => event.allSelected)
      .subscribe(newActiveStatus => this.isActive = newActiveStatus);
  }

  ngAfterContentInit() {
    if (!!this.table) {
      this._bindListener();
    }
  }
}

@Component({
  selector: 'tr[md-data-table-selectable-row]',
  template: `

          <md-checkbox [checked]="isActive"></md-checkbox>

        <ng-content></ng-content>
    `,
  directives: [MdCheckbox],
  host: {
    '[class.active]': 'isActive',
    '(click)': 'change($event)'
  }
})
export class MdDataTableSelectableRow extends AbstractMdDataTableSelectableRow {
  constructor(@Optional()
              @Inject(forwardRef(() => MdDataTable))
              public table: MdDataTable, protected _element: ElementRef) {
    super(table, _element);
  }

  /**
   * @param {any} element
   *
   * @returns {string}
   */
  _getIndex(element): string {
    return Array.prototype.indexOf.call(element.parentNode.children, element).toString();
  }

  _bindListener(): void {
    this.table.onSelectableChange
      .map(event => {
        return event.values !== undefined &&
          event.values.length &&
          (event.values.findIndex((value: string) => value === this.selectableValue)) !== -1;
      })
      .subscribe(newActiveStatus => this.isActive = newActiveStatus);
  }

  ngAfterContentInit() {
    let element = this._element.nativeElement;
    if (this.selectableValue === undefined) {
      this.selectableValue = this._getIndex(element);
    }

    if (!!this.table) {
      this._bindListener();
    }
  }
}


text:
package com.android.indie.school.cleancodemvvm.activity.home;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;

import static junit.framework.Assert.assertFalse;
import static junit.framework.Assert.assertTrue;

/**
 * Created by herisulistiyanto on 3/9/17.
 */
@RunWith(MockitoJUnitRunner.class)
public class HomeViewModelTest {

    private HomeViewModel viewModel;

    @Before
    public void setUp() throws Exception {
        viewModel = new HomeViewModel();
    }

    @Test
    public void testShouldIsInProgressTrue() throws Exception {
        viewModel.setInProgress(true);
        assertTrue(viewModel.isInProgress());
    }

    @Test
    public void testShouldSetInProgressFalse() throws Exception {
        viewModel.setInProgress(false);
        assertFalse(viewModel.isInProgress());
    }

}


text:
package io.katharsis.core.internal.dispatcher;

import java.util.Set;

import io.katharsis.core.internal.dispatcher.controller.BaseController;

/**
 * Gets the instances of the {@link BaseController}'s.
 */
public interface ControllerLookup {

    /**
     * @return the instances of the {@link BaseController}'s.
     */
    Set<BaseController> getControllers();
}


text:
<template name="Plant_Profile_Page">

            <button class="ui left labeled icon button">

              Previous
            </button>

            <button class="ui right labeled icon button" style="alignment: right; float: right">

              Next
            </button>

My Breadfruit Tree:

Breadfruit Tree

                  Bill Mullen
                 watered My Breadfruit Tree

                  1 Hour Ago

                   4 Likes

                Helen Troy confirmed plant identification 'Ulu

                  4 days ago

                   1 Like

                  Bill Mullen
                 marked My Breadfruit Tree

                  7 Days Ago

                   8 Likes

</template>


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ChangeListManager">
    <list default="true" id="7a82bc9d-2487-4c13-950b-72ad8a1e1bc4" name="Default" comment="">
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/query/queries.energy.js" afterPath="$PROJECT_DIR$/query/queries.energy.js" />
      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/routes/api.js" afterPath="$PROJECT_DIR$/routes/api.js" />
    </list>
    <ignored path="node-api-client.iws" />
    <ignored path=".idea/workspace.xml" />
    <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
    <option name="TRACKING_ENABLED" value="true" />
    <option name="SHOW_DIALOG" value="false" />
    <option name="HIGHLIGHT_CONFLICTS" value="true" />
    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
    <option name="LAST_RESOLUTION" value="IGNORE" />
  </component>
  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
  <component name="CreatePatchCommitExecutor">
    <option name="PATCH_PATH" value="" />
  </component>
  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
  <component name="FavoritesManager">
    <favorites_list name="node-api-client" />
  </component>
  <component name="FileEditorManager">
    <leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
      <file leaf-file-name="api.js" pinned="false" current-in-tab="true">
        <entry file="file://$PROJECT_DIR$/routes/api.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="611">
              <caret line="52" column="54" selection-start-line="52" selection-start-column="54" selection-end-line="52" selection-end-column="54" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="queries.power.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/query/queries.power.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="-1939">
              <caret line="29" column="48" selection-start-line="29" selection-start-column="48" selection-end-line="29" selection-end-column="48" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="queries.energy.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/query/queries.energy.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="626">
              <caret line="497" column="4" selection-start-line="497" selection-start-column="4" selection-end-line="500" selection-end-column="70" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="queries.device.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/query/queries.device.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="236">
              <caret line="66" column="31" selection-start-line="66" selection-start-column="31" selection-end-line="66" selection-end-column="31" />
              <folding />
            </state>
          </provider>
        </entry>
      </file>
      <file leaf-file-name="queries.user.js" pinned="false" current-in-tab="false">
        <entry file="file://$PROJECT_DIR$/query/queries.user.js">
          <provider selected="true" editor-type-id="text-editor">
            <state relative-caret-position="600">
              <caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="42" selection-end-column="0" />
              <folding>
                <element signature="e#0#42#0" expanded="false" />
              </folding>
            </state>
          </provider>
        </entry>
      </file>
    </leaf>
  </component>
  <component name="FileTemplateManagerImpl">
    <option name="RECENT_TEMPLATES">
      <list>
        <option value="JavaScript File" />
      </list>
    </option>
  </component>
  <component name="Git.Settings">
    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
  </component>
  <component name="IdeDocumentHistory">
    <option name="CHANGED_PATHS">
      <list>
        <option value="$PROJECT_DIR$/query/queries.power.js" />
        <option value="$PROJECT_DIR$/query/queries.device.js" />
        <option value="$PROJECT_DIR$/query/queries.user.js" />
        <option value="$PROJECT_DIR$/query/queries.energy.js" />
        <option value="$PROJECT_DIR$/routes/api.js" />
      </list>
    </option>
  </component>
  <component name="JsBuildToolGruntFileManager" detection-done="true" />
  <component name="JsBuildToolPackageJson" detection-done="true">
    <package-json value="$PROJECT_DIR$/package.json" />
  </component>
  <component name="JsGulpfileManager">
    <detection-done>true</detection-done>
  </component>
  <component name="ProjectFrameBounds">
    <option name="y" value="23" />
    <option name="width" value="1440" />
    <option name="height" value="873" />
  </component>
  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
    <OptionsSetting value="true" id="Add" />
    <OptionsSetting value="true" id="Remove" />
    <OptionsSetting value="true" id="Checkout" />
    <OptionsSetting value="true" id="Update" />
    <OptionsSetting value="true" id="Status" />
    <OptionsSetting value="true" id="Edit" />
    <ConfirmationsSetting value="0" id="Add" />
    <ConfirmationsSetting value="0" id="Remove" />
  </component>
  <component name="ProjectView">
    <navigator currentView="ProjectPane" proportions="" version="1">
      <flattenPackages />
      <showMembers />
      <showModules />
      <showLibraryContents />
      <hideEmptyPackages />
      <abbreviatePackageNames />
      <autoscrollToSource />
      <autoscrollFromSource />
      <sortByType />
      <manualOrder />
      <foldersAlwaysOnTop value="true" />
    </navigator>
    <panes>
      <pane id="ProjectPane">
        <subPane>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="routes" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
          <PATH>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="node-api-client" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
            <PATH_ELEMENT>
              <option name="myItemId" value="query" />
              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
            </PATH_ELEMENT>
          </PATH>
        </subPane>
      </pane>
      <pane id="Scope" />
      <pane id="Scratches" />
    </panes>
  </component>
  <component name="PropertiesComponent">
    <property name="settings.editor.selected.configurable" value="Settings.JavaScript" />
    <property name="settings.editor.splitter.proportion" value="0.2" />
    <property name="nodejs_interpreter_path" value="/usr/local/bin/node" />
    <property name="javascript.nodejs.core.library.configured.version" value="6.10.3" />
    <property name="WebServerToolWindowFactoryState" value="false" />
    <property name="HbShouldOpenHtmlAsHb" value="" />
    <property name="js-jscs-nodeInterpreter" value="/usr/local/bin/node" />
    <property name="JavaScriptPreferStrict" value="false" />
    <property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
  </component>
  <component name="RunManager">
    <configuration default="true" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application">
      <method />
    </configuration>
    <configuration default="true" type="DartTestRunConfigurationType" factoryName="Dart Test">
      <method />
    </configuration>
    <configuration default="true" type="JavaScriptTestRunnerKarma" factoryName="Karma">
      <config-file value="" />
      <node-interpreter value="project" />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="JavascriptDebugType" factoryName="JavaScript Debug">
      <method />
    </configuration>
    <configuration default="true" type="NodeJSConfigurationType" factoryName="Node.js" path-to-node="project" working-dir="">
      <method />
    </configuration>
    <configuration default="true" type="cucumber.js" factoryName="Cucumber.js">
      <option name="cucumberJsArguments" value="" />
      <option name="executablePath" />
      <option name="filePath" />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
      <node-interpreter>project</node-interpreter>
      <node-options />
      <gulpfile />
      <tasks />
      <arguments />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="js.build_tools.npm" factoryName="npm">
      <command value="run-script" />
      <scripts />
      <node-interpreter value="project" />
      <envs />
      <method />
    </configuration>
    <configuration default="true" type="mocha-javascript-test-runner" factoryName="Mocha">
      <node-interpreter>project</node-interpreter>
      <node-options />
      <working-directory />
      <pass-parent-env>true</pass-parent-env>
      <envs />
      <ui>bdd</ui>
      <extra-mocha-options />
      <test-kind>DIRECTORY</test-kind>
      <test-directory />
      <recursive>false</recursive>
      <method />
    </configuration>
  </component>
  <component name="ShelveChangesManager" show_recycled="false">
    <option name="remove_strategy" value="false" />
  </component>
  <component name="SvnConfiguration">
    <configuration />
  </component>
  <component name="TaskManager">
    <task active="true" id="Default" summary="Default task">
      <changelist id="7a82bc9d-2487-4c13-950b-72ad8a1e1bc4" name="Default" comment="" />
      <created>1496595854894</created>
      <option name="number" value="Default" />
      <option name="presentableId" value="Default" />
      <updated>1496595854894</updated>
      <workItem from="1496595856016" duration="23276000" />
      <workItem from="1497211563921" duration="947000" />
      <workItem from="1497349285928" duration="4786000" />
      <workItem from="1497375222034" duration="2123000" />
    </task>
    <servers />
  </component>
  <component name="TimeTrackingManager">
    <option name="totallyTimeSpent" value="31132000" />
  </component>
  <component name="ToolWindowManager">
    <frame x="0" y="23" width="1440" height="873" extended-state="0" />
    <editor active="true" />
    <layout>
      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.15416667" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.329602" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
      <window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
    </layout>
  </component>
  <component name="Vcs.Log.UiProperties">
    <option name="RECENTLY_FILTERED_USER_GROUPS">
      <collection />
    </option>
    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
      <collection />
    </option>
  </component>
  <component name="VcsContentAnnotationSettings">
    <option name="myLimit" value="2678400000" />
  </component>
  <component name="XDebuggerManager">
    <breakpoint-manager />
    <watches-manager />
  </component>
  <component name="editorHistoryManager">
    <entry file="file://$PROJECT_DIR$/routes/api.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="810">
          <caret line="54" column="23" selection-start-line="54" selection-start-column="13" selection-end-line="54" selection-end-column="23" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.power.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="495">
          <caret line="33" column="78" selection-start-line="33" selection-start-column="73" selection-end-line="33" selection-end-column="78" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.energy.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="4350">
          <caret line="290" column="13" selection-start-line="290" selection-start-column="13" selection-end-line="290" selection-end-column="13" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.device.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="990">
          <caret line="66" column="31" selection-start-line="66" selection-start-column="31" selection-end-line="66" selection-end-column="31" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.user.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding>
            <element signature="e#0#42#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/routes/api.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="645">
          <caret line="43" column="74" selection-start-line="43" selection-start-column="47" selection-end-line="43" selection-end-column="74" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.power.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="495">
          <caret line="33" column="78" selection-start-line="33" selection-start-column="73" selection-end-line="33" selection-end-column="78" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.energy.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/routes/api.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="405">
          <caret line="27" column="90" selection-start-line="27" selection-start-column="52" selection-end-line="27" selection-end-column="90" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.power.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="495">
          <caret line="33" column="78" selection-start-line="33" selection-start-column="73" selection-end-line="33" selection-end-column="78" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.energy.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.dbconn.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="0">
          <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.device.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="236">
          <caret line="66" column="31" selection-start-line="66" selection-start-column="31" selection-end-line="66" selection-end-column="31" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.user.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="600">
          <caret line="42" column="0" selection-start-line="42" selection-start-column="0" selection-end-line="42" selection-end-column="0" />
          <folding>
            <element signature="e#0#42#0" expanded="false" />
          </folding>
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.power.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="-1939">
          <caret line="29" column="48" selection-start-line="29" selection-start-column="48" selection-end-line="29" selection-end-column="48" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/query/queries.energy.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="626">
          <caret line="497" column="4" selection-start-line="497" selection-start-column="4" selection-end-line="500" selection-end-column="70" />
          <folding />
        </state>
      </provider>
    </entry>
    <entry file="file://$PROJECT_DIR$/routes/api.js">
      <provider selected="true" editor-type-id="text-editor">
        <state relative-caret-position="611">
          <caret line="52" column="54" selection-start-line="52" selection-start-column="54" selection-end-line="52" selection-end-column="54" />
          <folding />
        </state>
      </provider>
    </entry>
  </component>
</project>


text:
namespace Raz {

PhysicsSystem::PhysicsSystem() {
  registerComponents<Collider, RigidBody>();
}

bool PhysicsSystem::step(float deltaTime) {
  const float relativeFriction = std::pow(m_friction, deltaTime);

  for (Entity* entity : m_entities) {
    if (!entity->isEnabled() || !entity->hasComponent<RigidBody>())
      continue;

    auto& rigidBody = entity->getComponent<RigidBody>();

    if (rigidBody.getMass() <= 0.f)
      continue;

    const Vec3f acceleration = (rigidBody.getMass() * m_gravity + rigidBody.getForces()) * rigidBody.getInvMass();
    const Vec3f oldVelocity  = rigidBody.getVelocity();

    const Vec3f velocity = oldVelocity * relativeFriction + acceleration * deltaTime;
    rigidBody.setVelocity(velocity);

    auto& transform = entity->getComponent<Transform>();

    rigidBody.m_oldPosition = transform.getPosition();
    transform.translate((oldVelocity + velocity) * 0.5f * deltaTime);

    // The following acceleration calculation should be added to the translation to get a more accurate result:
    //    acceleration * deltaTime * deltaTime * 0.5f
    //  However, the acceleration would be multiplied by a tiny factor, making its effect barely noticeable
    //  for a standard acceleration value. As such, it is left out of the displacement equation
  }

  solveConstraints();

  return true;
}

void PhysicsSystem::solveConstraints() {
  for (Entity* entity : m_entities) {
    if (!entity->isEnabled() || !entity->hasComponent<RigidBody>())
      continue;

    auto& rigidBody = entity->getComponent<RigidBody>();

    if (rigidBody.getMass() <= 0.f)
      continue;

    const Vec3f velocity    = rigidBody.getVelocity();
    const Vec3f velocityDir = (velocity.computeSquaredLength() != 0.f ? velocity.normalize() : Vec3f(0.f));

    for (Entity* collidableEntity : m_entities) {
      if (collidableEntity == entity || !collidableEntity->isEnabled() || !collidableEntity->hasComponent<Collider>())
        continue;

      assert("Error: A collidable entity must have a Transform component." && collidableEntity->hasComponent<Transform>());

      auto& collider = collidableEntity->getComponent<Collider>();

      // The collision detection is made in the collider's local space
      // The test shapes/rays must thus be translated into that space
      const Vec3f colliderPos   = collidableEntity->getComponent<Transform>().getPosition();
      const Vec3f localStartPos = rigidBody.m_oldPosition - colliderPos;

      auto& transform = entity->getComponent<Transform>();

      // We first try to determine if the last movement gave an intersection
      // This is necessary in case our object has travelled too fast right through the collider,
      //  ending behind it
      const Line movementLine(localStartPos, transform.getPosition() - colliderPos);
      if (!collider.intersects(movementLine))
        continue;

      const Ray ray(localStartPos, velocityDir);

      RayHit hit;
      if (!collider.intersects(ray, &hit))
        continue;

      // Setting the entity's new position a little above the collision point
      const Vec3f newPos = hit.position + hit.normal * 0.002f + colliderPos;

      rigidBody.m_oldPosition = newPos;
      transform.setPosition(newPos);

      //                                     Vt/paraVec
      //  Vel  N  Refl                  \---->
      //    \  ^  ^                     | \          Vn is the velocity's perpendicular component to the surface
      //     \ | /        ->            |   \        Vt is the velocity's parallel component to the surface
      // _____v|/______      Vn/perpVec v    v Vel

      const Vec3f paraVec = hit.normal * velocity.dot(hit.normal);
      const Vec3f perpVec = velocity - paraVec;

      rigidBody.setVelocity(perpVec - paraVec * rigidBody.getBounciness());

      break;
    }
  }
}

} // namespace Raz


text:
import defineElement from '../../GameEngine/defineElement';
import GameOver from './GameOver';
import DefenseExplosion from './DefenseExplosion';

const GameStatus = defineElement({
  name: 'GameStatus',
  init({state, config}, game) {
    const {resolutions = 0} = config;
    state.resolutions = resolutions;
  },
  subscribe: {
    missileResolved(data, element, game) {
      const {state} = element;
      state.resolutions = state.resolutions + 1;
      if (!game.state.gameOver && (state.resolutions === game.config.missileCount) ) {
        game.publications.publish('gameOver', { winner: true});
      }
    },
    citizensDestroyed(data, element, game) {
      game.publications.publish('gameOver', { winner: false});
    },
    gameOver(data, element, game) {
      game.state.gameOver = true;
      game.add( GameOver({winner: data.winner}) );
    },
    reset(data, element, game) {
      game.reset();
    },
    createExplosion(data, element, game) {
      const { x, y, stroke } = data;
      game.add(
        DefenseExplosion({
          x: x,
          y: y
        })
      );
    }
  },
});

export default GameStatus;


text:
function path = getDistanceSubpath( obj )
% GETDISTANCESUBPATH  Get distance subpath of nlsaPairwiseDistance object
%
% Modified 2013/02/10

path = obj.pathY;


text:
import React, { Component } from 'react';
import { connect } from 'react-redux';
import {bindActionCreators} from 'redux';
import { Link } from 'react-router';
import { List } from 'semantic-ui-react';
import { fetchRoster } from './../actions/action_index';

class Roster extends Component {
   componentWillMount(){
      this.props.fetchRoster();
   }

  renderList() {
    if(!this.props.profiles.roster.length) {
      return
Loading Roster...
;
    }
     return this.props.profiles.roster.map((profile) => {
       if (!profile.active) {return null} // don't show profile unless active
        return (

 {profile.nickname ? profile.nickname : profile.firstname} {profile.lastname.charAt(0).toUpperCase()}

 Address: {profile.address}, {profile.city} {profile.state}

 Phone: {profile.homephone}, Cell: {profile.cellphone ? profile.cellphone : 'none'}

 Email: {profile.email}

         )
     })
  }

  render() {
     return(

           {this.renderList()}

     )
  }
}

const mapStateToProps = function({ profiles }) {
  return { profiles }
};

const mapDispatchToProps = function (dispatch) {
  return bindActionCreators({ fetchRoster }, dispatch);
};

export default connect(mapStateToProps, mapDispatchToProps)(Roster);


text:
from setuptools import setup, find_packages
import sys, os

version = '0.9'

setup(name='WebOb',
      version=version,
      description="WSGI request and response object",
      long_description="""\
WebOb provides wrappers around the WSGI request environment, and an
object to help create WSGI responses.

The objects map much of the specified behavior of HTTP, including
header parsing and accessors for other standard parts of the
environment.
""",
      classifiers=[
        "Development Status :: 4 - Beta",
        "Framework :: Paste",
        "Intended Audience :: Developers",
        "License :: OSI Approved :: MIT License",
        "Topic :: Internet :: WWW/HTTP :: WSGI",
        "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
      ],
      keywords='wsgi request web http',
      author='Ian Bicking',
      author_email='ianb@colorstudy.com',
      url='http://pythonpaste.org/webob/',
      license='MIT',
      packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
      include_package_data=True,
      zip_safe=True,
      )


text:
package org.junit.tests;

import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.BlockJUnit4ClassRunner;
import org.junit.runners.ParentRunner;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerScheduler;

public class ParentRunnerTest {
	public static String log= "";

	public static class FruitTest {
		@Test
		public void apple() {
			log+= "apple ";
		}

		@Test
		public void banana() {
			log+= "banana ";
		}
	}

	@Test
	public void useChildHarvester() throws InitializationError {
		log= "";
		ParentRunner<?> runner= new BlockJUnit4ClassRunner(FruitTest.class);
		runner.setScheduler(new RunnerScheduler() {
			public void schedule(Runnable childStatement) {
				log+= "before ";
				childStatement.run();
				log+= "after ";
			}

			public void finished() {
				log+= "afterAll ";
			}
		});

		runner.run(new RunNotifier());
		assertEquals("before apple after before banana after afterAll ", log);
	}
}