text:
'use strict';

var _ = require('lodash');
var Q = require('q');
var ActivityList = require('./workspace/activity').ActivityList;
var EventList = require('./workspace/event').EventList;
var Page = require('../../../base/Page');
var TaskList = require('./workspace/task').TaskList;
var TaskQueueList = require('./workspace/taskQueue').TaskQueueList;
var WorkerList = require('./workspace/worker').WorkerList;
var WorkflowList = require('./workspace/workflow').WorkflowList;
var WorkspaceStatisticsList = require(
    './workspace/workspaceStatistics').WorkspaceStatisticsList;
var deserialize = require('../../../base/deserialize');
var values = require('../../../base/values');

var WorkspacePage;
var WorkspaceList;
var WorkspaceInstance;
var WorkspaceContext;

/* jshint ignore:start */
/**
 * @constructor Twilio.Taskrouter.V1.WorkspacePage
 * @augments Page
 * @description Initialize the WorkspacePage
 *
 * @param {Twilio.Taskrouter.V1} version - Version of the resource
 * @param {object} response - Response from the API
 *
 * @returns WorkspacePage
 */
/* jshint ignore:end */
function WorkspacePage(version, response) {
  Page.prototype.constructor.call(this, version, response);

  // Path Solution
  this._solution = {};
}

_.extend(WorkspacePage.prototype, Page.prototype);
WorkspacePage.prototype.constructor = WorkspacePage;

/* jshint ignore:start */
/**
 * Build an instance of WorkspaceInstance
 *
 * @function getInstance
 * @memberof Twilio.Taskrouter.V1.WorkspacePage
 * @instance
 *
 * @param {object} payload - Payload response from the API
 *
 * @returns WorkspaceInstance
 */
/* jshint ignore:end */
WorkspacePage.prototype.getInstance = function getInstance(payload) {
  return new WorkspaceInstance(
    this._version,
    payload
  );
};

/* jshint ignore:start */
/**
 * @constructor Twilio.Taskrouter.V1.WorkspaceList
 * @description Initialize the WorkspaceList
 *
 * @param {Twilio.Taskrouter.V1} version - Version of the resource
 */
/* jshint ignore:end */
function WorkspaceList(version) {
  /* jshint ignore:start */
  /**
   * @function workspaces
   * @memberof Twilio.Taskrouter.V1
   * @instance
   *
   * @param {string} sid - sid of instance
   *
   * @returns {Twilio.Taskrouter.V1.WorkspaceContext}
   */
  /* jshint ignore:end */
  function WorkspaceListInstance(sid) {
    return WorkspaceListInstance.get(sid);
  }

  WorkspaceListInstance._version = version;
  // Path Solution
  WorkspaceListInstance._solution = {};
  WorkspaceListInstance._uri = _.template(
    '/Workspaces' // jshint ignore:line
  )(WorkspaceListInstance._solution);
  /* jshint ignore:start */
  /**
   * Streams WorkspaceInstance records from the API.
   *
   * This operation lazily loads records as efficiently as possible until the limit
   * is reached.
   *
   * The results are passed into the callback function, so this operation is memory efficient.
   *
   * If a function is passed as the first argument, it will be used as the callback function.
   *
   * @function each
   * @memberof Twilio.Taskrouter.V1.WorkspaceList
   * @instance
   *
   * @param {object|function} opts - ...
   * @param {string} [opts.friendlyName] - The friendly_name
   * @param {number} [opts.limit] -
   *         Upper limit for the number of records to return.
   *         each() guarantees never to return more than limit.
   *         Default is no limit
   * @param {number} [opts.pageSize=50] -
   *         Number of records to fetch per request,
   *         when not set will use the default value of 50 records.
   *         If no pageSize is defined but a limit is defined,
   *         each() will attempt to read the limit with the most efficient
   *         page size, i.e. min(limit, 1000)
   * @param {Function} [opts.callback] -
   *         Function to process each record. If this and a positional
   * callback are passed, this one will be used
   * @param {Function} [opts.done] -
   *          Function to be called upon completion of streaming
   * @param {Function} [callback] - Function to process each record
   */
  /* jshint ignore:end */
  WorkspaceListInstance.each = function each(opts, callback) {
    opts = opts || {};
    if (_.isFunction(opts)) {
      opts = { callback: opts };
    } else if (_.isFunction(callback) && !_.isFunction(opts.callback)) {
      opts.callback = callback;
    }

    if (_.isUndefined(opts.callback)) {
      throw new Error('Callback function must be provided');
    }

    var done = false;
    var currentPage = 1;
    var limits = this._version.readLimits({
      limit: opts.limit,
      pageSize: opts.pageSize
    });

    function onComplete(error) {
      done = true;
      if (_.isFunction(opts.done)) {
        opts.done(error);
      }
    }

    function fetchNextPage(fn) {
      var promise = fn();
      if (_.isUndefined(promise)) {
        onComplete();
        return;
      }

      promise.then(function(page) {
        _.each(page.instances, function(instance) {
          if (done) {
            return false;
          }

          opts.callback(instance, onComplete);
        });

        if ((limits.pageLimit && limits.pageLimit <= currentPage)) {
          onComplete();
        } else if (!done) {
          currentPage++;
          fetchNextPage(_.bind(page.nextPage, page));
        }
      });

      promise.catch(onComplete);
    }

    fetchNextPage(_.bind(this.page, this, opts));
  };

  /* jshint ignore:start */
  /**
   * @description Lists WorkspaceInstance records from the API as a list.
   *
   * If a function is passed as the first argument, it will be used as the callback function.
   *
   * @function list
   * @memberof Twilio.Taskrouter.V1.WorkspaceList
   * @instance
   *
   * @param {object|function} opts - ...
   * @param {string} [opts.friendlyName] - The friendly_name
   * @param {number} [opts.limit] -
   *         Upper limit for the number of records to return.
   *         list() guarantees never to return more than limit.
   *         Default is no limit
   * @param {number} [opts.pageSize] -
   *         Number of records to fetch per request,
   *         when not set will use the default value of 50 records.
   *         If no page_size is defined but a limit is defined,
   *         list() will attempt to read the limit with the most
   *         efficient page size, i.e. min(limit, 1000)
   * @param {function} [callback] - Callback to handle list of records
   *
   * @returns {Promise} Resolves to a list of records
   */
  /* jshint ignore:end */
  WorkspaceListInstance.list = function list(opts, callback) {
    if (_.isFunction(opts)) {
      callback = opts;
      opts = {};
    }
    opts = opts || {};
    var deferred = Q.defer();
    var allResources = [];
    opts.callback = function(resource, done) {
      allResources.push(resource);

      if (!_.isUndefined(opts.limit) && allResources.length === opts.limit) {
        done();
      }
    };

    opts.done = function(error) {
      if (_.isUndefined(error)) {
        deferred.resolve(allResources);
      } else {
        deferred.reject(error);
      }
    };

    if (_.isFunction(callback)) {
      deferred.promise.nodeify(callback);
    }

    this.each(opts);
    return deferred.promise;
  };

  /* jshint ignore:start */
  /**
   * Retrieve a single page of WorkspaceInstance records from the API.
   * Request is executed immediately
   *
   * If a function is passed as the first argument, it will be used as the callback function.
   *
   * @function page
   * @memberof Twilio.Taskrouter.V1.WorkspaceList
   * @instance
   *
   * @param {object|function} opts - ...
   * @param {string} [opts.friendlyName] - The friendly_name
   * @param {string} [opts.pageToken] - PageToken provided by the API
   * @param {number} [opts.pageNumber] -
   *          Page Number, this value is simply for client state
   * @param {number} [opts.pageSize] - Number of records to return, defaults to 50
   * @param {function} [callback] - Callback to handle list of records
   *
   * @returns {Promise} Resolves to a list of records
   */
  /* jshint ignore:end */
  WorkspaceListInstance.page = function page(opts, callback) {
    if (_.isFunction(opts)) {
      callback = opts;
      opts = {};
    }
    opts = opts || {};

    var deferred = Q.defer();
    var data = values.of({
      'FriendlyName': opts.friendlyName,
      'PageToken': opts.pageToken,
      'Page': opts.pageNumber,
      'PageSize': opts.pageSize
    });

    var promise = this._version.page({
      uri: this._uri,
      method: 'GET',
      params: data
    });

    promise = promise.then(function(payload) {
      deferred.resolve(new WorkspacePage(
        this._version,
        payload,
        this._solution.sid
      ));
    }.bind(this));

    promise.catch(function(error) {
      deferred.reject(error);
    });

    if (_.isFunction(callback)) {
      deferred.promise.nodeify(callback);
    }

    return deferred.promise;
  };

  /* jshint ignore:start */
  /**
   * create a WorkspaceInstance
   *
   * @function create
   * @memberof Twilio.Taskrouter.V1.WorkspaceList
   * @instance
   *
   * @param {object} opts - ...
   * @param {string} opts.friendlyName - The friendly_name
   * @param {string} [opts.eventCallbackUrl] - The event_callback_url
   * @param {string} [opts.template] - The template
   * @param {function} [callback] - Callback to handle processed record
   *
   * @returns {Promise} Resolves to processed WorkspaceInstance
   */
  /* jshint ignore:end */
  WorkspaceListInstance.create = function create(opts, callback) {
    if (_.isUndefined(opts)) {
      throw new Error('Required parameter "opts" missing.');
    }
    if (_.isUndefined(opts.friendlyName)) {
      throw new Error('Required parameter "opts.friendlyName" missing.');
    }

    var deferred = Q.defer();
    var data = values.of({
      'FriendlyName': opts.friendlyName,
      'EventCallbackUrl': opts.eventCallbackUrl,
      'Template': opts.template
    });

    var promise = this._version.create({
      uri: this._uri,
      method: 'POST',
      data: data
    });

    promise = promise.then(function(payload) {
      deferred.resolve(new WorkspaceInstance(
        this._version,
        payload,
        this._solution.sid
      ));
    }.bind(this));

    promise.catch(function(error) {
      deferred.reject(error);
    });

    if (_.isFunction(callback)) {
      deferred.promise.nodeify(callback);
    }

    return deferred.promise;
  };

  /* jshint ignore:start */
  /**
   * Constructs a workspace
   *
   * @function get
   * @memberof Twilio.Taskrouter.V1.WorkspaceList
   * @instance
   *
   * @param {string} sid - The sid
   *
   * @returns {Twilio.Taskrouter.V1.WorkspaceContext}
   */
  /* jshint ignore:end */
  WorkspaceListInstance.get = function get(sid) {
    return new WorkspaceContext(
      this._version,
      sid
    );
  };

  return WorkspaceListInstance;
}

/* jshint ignore:start */
/**
 * @constructor Twilio.Taskrouter.V1.WorkspaceInstance
 * @description Initialize the WorkspaceContext
 *
 * @property {string} accountSid - The account_sid
 * @property {Date} dateCreated - The date_created
 * @property {Date} dateUpdated - The date_updated
 * @property {string} defaultActivityName - The default_activity_name
 * @property {string} defaultActivitySid - The default_activity_sid
 * @property {string} eventCallbackUrl - The event_callback_url
 * @property {string} friendlyName - The friendly_name
 * @property {string} sid - The sid
 * @property {string} timeoutActivityName - The timeout_activity_name
 * @property {string} timeoutActivitySid - The timeout_activity_sid
 *
 * @param {Twilio.Taskrouter.V1} version - Version of the resource
 * @param {object} payload - The instance payload
 * @param {sid} sid - The sid
 */
/* jshint ignore:end */
function WorkspaceInstance(version, payload, sid) {
  this._version = version;

  // Marshaled Properties
  this.accountSid = payload.account_sid; // jshint ignore:line
  this.dateCreated = deserialize.iso8601DateTime(payload.date_created); // jshint ignore:line
  this.dateUpdated = deserialize.iso8601DateTime(payload.date_updated); // jshint ignore:line
  this.defaultActivityName = payload.default_activity_name; // jshint ignore:line
  this.defaultActivitySid = payload.default_activity_sid; // jshint ignore:line
  this.eventCallbackUrl = payload.event_callback_url; // jshint ignore:line
  this.friendlyName = payload.friendly_name; // jshint ignore:line
  this.sid = payload.sid; // jshint ignore:line
  this.timeoutActivityName = payload.timeout_activity_name; // jshint ignore:line
  this.timeoutActivitySid = payload.timeout_activity_sid; // jshint ignore:line

  // Context
  this._context = undefined;
  this._solution = {
    sid: sid || this.sid,
  };
}

Object.defineProperty(WorkspaceInstance.prototype,
  '_proxy', {
  get: function() {
    if (!this._context) {
      this._context = new WorkspaceContext(
        this._version,
        this._solution.sid
      );
    }

    return this._context;
  },
});

/* jshint ignore:start */
/**
 * fetch a WorkspaceInstance
 *
 * @function fetch
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @param {function} [callback] - Callback to handle processed record
 *
 * @returns {Promise} Resolves to processed WorkspaceInstance
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.fetch = function fetch(callback) {
  return this._proxy.fetch(callback);
};

/* jshint ignore:start */
/**
 * update a WorkspaceInstance
 *
 * @function update
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @param {object|function} opts - ...
 * @param {string} [opts.defaultActivitySid] - The default_activity_sid
 * @param {string} [opts.eventCallbackUrl] - The event_callback_url
 * @param {string} [opts.friendlyName] - The friendly_name
 * @param {string} [opts.timeoutActivitySid] - The timeout_activity_sid
 * @param {function} [callback] - Callback to handle processed record
 *
 * @returns {Promise} Resolves to processed WorkspaceInstance
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.update = function update(opts, callback) {
  return this._proxy.update(opts, callback);
};

/* jshint ignore:start */
/**
 * remove a WorkspaceInstance
 *
 * @function remove
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @param {function} [callback] - Callback to handle processed record
 *
 * @returns {Promise} Resolves to processed WorkspaceInstance
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.remove = function remove(callback) {
  return this._proxy.remove(callback);
};

/* jshint ignore:start */
/**
 * Access the activities
 *
 * @function activities
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.ActivityList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.activities = function activities() {
  return this._proxy.activities;
};

/* jshint ignore:start */
/**
 * Access the events
 *
 * @function events
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.EventList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.events = function events() {
  return this._proxy.events;
};

/* jshint ignore:start */
/**
 * Access the tasks
 *
 * @function tasks
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.TaskList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.tasks = function tasks() {
  return this._proxy.tasks;
};

/* jshint ignore:start */
/**
 * Access the taskQueues
 *
 * @function taskQueues
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.TaskQueueList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.taskQueues = function taskQueues() {
  return this._proxy.taskQueues;
};

/* jshint ignore:start */
/**
 * Access the workers
 *
 * @function workers
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.WorkerList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.workers = function workers() {
  return this._proxy.workers;
};

/* jshint ignore:start */
/**
 * Access the workflows
 *
 * @function workflows
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.WorkflowList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.workflows = function workflows() {
  return this._proxy.workflows;
};

/* jshint ignore:start */
/**
 * Access the statistics
 *
 * @function statistics
 * @memberof Twilio.Taskrouter.V1.WorkspaceInstance
 * @instance
 *
 * @returns {Twilio.Taskrouter.V1.WorkspaceContext.WorkspaceStatisticsList}
 */
/* jshint ignore:end */
WorkspaceInstance.prototype.statistics = function statistics() {
  return this._proxy.statistics;
};

/* jshint ignore:start */
/**
 * @constructor Twilio.Taskrouter.V1.WorkspaceContext
 * @description Initialize the WorkspaceContext
 *
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.ActivityList} activities -
 *          activities resource
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.EventList} events -
 *          events resource
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.TaskList} tasks -
 *          tasks resource
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.TaskQueueList} taskQueues -
 *          taskQueues resource
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.WorkerList} workers -
 *          workers resource
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.WorkflowList} workflows -
 *          workflows resource
 * @property {Twilio.Taskrouter.V1.WorkspaceContext.WorkspaceStatisticsList} statistics -
 *          statistics resource
 *
 * @param {Twilio.Taskrouter.V1} version - Version of the resource
 * @param {sid} sid - The sid
 */
/* jshint ignore:end */
function WorkspaceContext(version, sid) {
  this._version = version;

  // Path Solution
  this._solution = {
    sid: sid,
  };
  this._uri = _.template(
    '/Workspaces/<%= sid %>' // jshint ignore:line
  )(this._solution);

  // Dependents
  this._activities = undefined;
  this._events = undefined;
  this._tasks = undefined;
  this._taskQueues = undefined;
  this._workers = undefined;
  this._workflows = undefined;
  this._statistics = undefined;
}

/* jshint ignore:start */
/**
 * fetch a WorkspaceInstance
 *
 * @function fetch
 * @memberof Twilio.Taskrouter.V1.WorkspaceContext
 * @instance
 *
 * @param {function} [callback] - Callback to handle processed record
 *
 * @returns {Promise} Resolves to processed WorkspaceInstance
 */
/* jshint ignore:end */
WorkspaceContext.prototype.fetch = function fetch(callback) {
  var deferred = Q.defer();
  var promise = this._version.fetch({
    uri: this._uri,
    method: 'GET'
  });

  promise = promise.then(function(payload) {
    deferred.resolve(new WorkspaceInstance(
      this._version,
      payload,
      this._solution.sid
    ));
  }.bind(this));

  promise.catch(function(error) {
    deferred.reject(error);
  });

  if (_.isFunction(callback)) {
    deferred.promise.nodeify(callback);
  }

  return deferred.promise;
};

/* jshint ignore:start */
/**
 * update a WorkspaceInstance
 *
 * @function update
 * @memberof Twilio.Taskrouter.V1.WorkspaceContext
 * @instance
 *
 * @param {object|function} opts - ...
 * @param {string} [opts.defaultActivitySid] - The default_activity_sid
 * @param {string} [opts.eventCallbackUrl] - The event_callback_url
 * @param {string} [opts.friendlyName] - The friendly_name
 * @param {string} [opts.timeoutActivitySid] - The timeout_activity_sid
 * @param {function} [callback] - Callback to handle processed record
 *
 * @returns {Promise} Resolves to processed WorkspaceInstance
 */
/* jshint ignore:end */
WorkspaceContext.prototype.update = function update(opts, callback) {
  if (_.isFunction(opts)) {
    callback = opts;
    opts = {};
  }
  opts = opts || {};

  var deferred = Q.defer();
  var data = values.of({
    'DefaultActivitySid': opts.defaultActivitySid,
    'EventCallbackUrl': opts.eventCallbackUrl,
    'FriendlyName': opts.friendlyName,
    'TimeoutActivitySid': opts.timeoutActivitySid
  });

  var promise = this._version.update({
    uri: this._uri,
    method: 'POST',
    data: data
  });

  promise = promise.then(function(payload) {
    deferred.resolve(new WorkspaceInstance(
      this._version,
      payload,
      this._solution.sid
    ));
  }.bind(this));

  promise.catch(function(error) {
    deferred.reject(error);
  });

  if (_.isFunction(callback)) {
    deferred.promise.nodeify(callback);
  }

  return deferred.promise;
};

/* jshint ignore:start */
/**
 * remove a WorkspaceInstance
 *
 * @function remove
 * @memberof Twilio.Taskrouter.V1.WorkspaceContext
 * @instance
 *
 * @param {function} [callback] - Callback to handle processed record
 *
 * @returns {Promise} Resolves to processed WorkspaceInstance
 */
/* jshint ignore:end */
WorkspaceContext.prototype.remove = function remove(callback) {
  var deferred = Q.defer();
  var promise = this._version.remove({
    uri: this._uri,
    method: 'DELETE'
  });

  promise = promise.then(function(payload) {
    deferred.resolve(payload);
  }.bind(this));

  promise.catch(function(error) {
    deferred.reject(error);
  });

  if (_.isFunction(callback)) {
    deferred.promise.nodeify(callback);
  }

  return deferred.promise;
};

Object.defineProperty(WorkspaceContext.prototype,
  'activities', {
  get: function() {
    if (!this._activities) {
      this._activities = new ActivityList(
        this._version,
        this._solution.sid
      );
    }
    return this._activities;
  },
});

Object.defineProperty(WorkspaceContext.prototype,
  'events', {
  get: function() {
    if (!this._events) {
      this._events = new EventList(
        this._version,
        this._solution.sid
      );
    }
    return this._events;
  },
});

Object.defineProperty(WorkspaceContext.prototype,
  'tasks', {
  get: function() {
    if (!this._tasks) {
      this._tasks = new TaskList(
        this._version,
        this._solution.sid
      );
    }
    return this._tasks;
  },
});

Object.defineProperty(WorkspaceContext.prototype,
  'taskQueues', {
  get: function() {
    if (!this._taskQueues) {
      this._taskQueues = new TaskQueueList(
        this._version,
        this._solution.sid
      );
    }
    return this._taskQueues;
  },
});

Object.defineProperty(WorkspaceContext.prototype,
  'workers', {
  get: function() {
    if (!this._workers) {
      this._workers = new WorkerList(
        this._version,
        this._solution.sid
      );
    }
    return this._workers;
  },
});

Object.defineProperty(WorkspaceContext.prototype,
  'workflows', {
  get: function() {
    if (!this._workflows) {
      this._workflows = new WorkflowList(
        this._version,
        this._solution.sid
      );
    }
    return this._workflows;
  },
});

Object.defineProperty(WorkspaceContext.prototype,
  'statistics', {
  get: function() {
    if (!this._statistics) {
      this._statistics = new WorkspaceStatisticsList(
        this._version,
        this._solution.sid
      );
    }
    return this._statistics;
  },
});

module.exports = {
  WorkspacePage: WorkspacePage,
  WorkspaceList: WorkspaceList,
  WorkspaceInstance: WorkspaceInstance,
  WorkspaceContext: WorkspaceContext
};


text:
describe Moonshot::Commands::Build do

  it 'should raise RuntimeError when send --skip-ci-status param without GithubRelease plugin' do
    cli_dispatcher = Moonshot::CommandLineDispatcher.new('build', subject, {})
    parser = cli_dispatcher.send(:build_parser, subject)
    expect { parser.parse(%w(--skip-ci-status)) }.to raise_error(RuntimeError)
  end

  it 'should not raise RuntimeError when send --skip-ci-status param with GithubRelease plugin' do
    Moonshot.config = Moonshot::ControllerConfig.new
    Moonshot.config do |c|
      c.build_mechanism = Moonshot::BuildMechanism::GithubRelease.new('')
    end
    cli_dispatcher = Moonshot::CommandLineDispatcher.new('build', subject, {})
    parser = cli_dispatcher.send(:build_parser, subject)
    expect { parser.parse(%w(--skip-ci-status)) }.to_not raise_error
  end

end

redpajama_set_name: RedPajamaGithub


text:
Repository for help me installing some important tools on my laptop, based on **TeaLinuxOS 8.1 Peppermint 64-bit** Build on Ubuntu 16.04 - http://tealinuxos.org/

## Desktop Setting
**[optional theme]**

`sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/Horst3180/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/arc-theme.list"`

`sudo apt-get update`

`sudo apt-get install arc-theme`

`setting --> appearance --> Arc-Darker`

> **Note :** *Do With Your Own Risk*
>
>**[used themes]**
[macOS-Sierra](https://github.com/B00merang-Project/macOS-Sierra)
>
>**[used icons]**
[la-capitaine-icon-theme](https://github.com/keeferrourke/la-capitaine-icon-theme)
>
>`cp -r` copy directory along the entire file contents
>
>change the background (oke.png its my background filename) :
>
>`sudo cp /home/bambang/Pictures/Wallpapers/oke.png /usr/share/xfce4/backdrops/`

**Dock**

*Installing cairo-dock available at **software center**.*

remove the line above dock (cairo-dock)

`settings --> window manager tweaks --> compositor`

**uncheck :** *Show shadows under dock windows*

**Auto Start on startup**

Settings --> Session and startup --> Application Autostart --> (+) Add

```
Name: Cairo Dock Start
Description : Autostart cairo-dock
Command: cairo-dock &
```

------

## Application

**BROWSER**

Default Browser TeaLinuxOS [Firefox Developer Edition](https://www.mozilla.org/en-US/firefox/developer/)

If you want used [Google Chrome](https://www.google.com/chrome/browser/desktop/index.html)

Chrome's download "Show in Folder" does not pop up folder
This time, Google did not manage to help me

Is it normal for nautilus not to pop up on the screen when I click "Show in Folder" in Chrome?

The folder did open but stay at a launcher, is it possible to make it pop up on my screen? with highlights if possible ..

**[Solved]** Open your terminal Just Press **F12** in TeaLinuxOS

`mimeopen -d /home/bambang/Downloads/`

```
Please choose a default application for files of type inode/directory

	1) Files  (nautilus-folder-handler)
	2) Audacious  (audacious)
	3) Open Folder with Thunar  (Thunar-folder-handler)
	4) Files  (org.gnome.Nautilus)
	5) Other...

use application# 1

```
*at use application# enter 1 Its a Files  (nautilus-folder-handler)*

------

**MUSIC**

[Spotify for linux](https://www.spotify.com/id/download/linux/)

```
# 1. Add the Spotify repository signing key to be able to verify downloaded packages
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886

# 2. Add the Spotify repository
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

# 3. Update list of available packages
sudo apt-get update

# 4. Install Spotify
sudo apt-get install spotify-client

```
------

**SOCIAL MEDIA**

**Slack Desktop**

https://slack.com/downloads/linux

**Telegram Desktop**

https://desktop.telegram.org/

------

**OFFICES**

The default apps offices in TeaLinuxOS LibreOffices but i dont like this, So I'm Uninstall it.

```
sudo apt-get remove --purge libreoffice*
sudo apt-get clean
sudo apt-get autoremove

```

i'm used WPS Offices

http://wps-community.org/downloads

### Etc

**gscan2pdf**

gscan2pdf can control regular or sheet-fed (ADF) scanners with SANE via libsane-perl, scanimage or scanadf, and can scan multiple pages at once. It presents a thumbnail view of scanned pages, and permits simple operations such as cropping, rotating and deleting pages.

**To Convert PDF To JPG**

Open Terminal

`convert -density 300 file.pdf file.jpg`

**How To Screenshot My Login Screen**

TAKE SCREENSHOT OF LOGIN SCREEN IN **TeaLinuxOS**

Create a new file, preferably in your Home directory. Name it **screenshot.sh** or anything you like. Add the following lines in this file:

```
chvt 7; sleep 5s; DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 xwd -root -out ~/screenshot.xwd; convert ~/screenshot.xwd ~/screenshot.png; rm ~/screenshot.xwd

```
You must give the script execution rights:

`sudo chmod +x screenshot.sh`

Now when everything is ready, log out of the system. Press Ctrl+Alt+F1 at the login screen to go console mode. Login with your user credential. Run the screenshot script like this:

`sudo ./screenshot.sh`

Once the script is run, it will take you back to login screen graphical interface (chvt 7) and after five seconds it will take and save the screenshot in your home directory with a file name screenshot.png.

[References](https://itsfoss.com/screenshot-login-screen-ubuntu-linux/)

**Google Earth**

```
cd /tmp
mkdir google-earth && cd google-earth
wget http://archive.ubuntu.com/ubuntu/pool/main/l/lsb/lsb-invalid-mta_4.1+Debian11ubuntu8_all.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/l/lsb/lsb-security_4.1+Debian11ubuntu8_amd64.deb
wget http://archive.ubuntu.com/ubuntu/pool/main/l/lsb/lsb-core_4.1+Debian11ubuntu8_amd64.deb
sudo dpkg -i *.deb
sudo apt -f install
```

`sudo apt-get install -f`

Download Google earth

https://www.google.com/earth/download/gep/agree.html

------

## WebDev Apps

>**ATOM** - A hackable text editor for the 21st Century

https://atom.io/

**Packages for Atom**

- open-terminal-here
- vk-terminal
- minimap
- logo-file-icons
- color-picker

```
bambang@idbmb  ~/fonts/DejaVuSansMono   master ●  sudo mv DejaVu\ Sans\ Mono\ for\ Powerline.ttf /home/bambang/.fonts/
```

>**ZSH** - Zsh is a shell designed for interactive use, although it is also a powerful scripting language. More information can be found on the "Zsh Web Pages" sites.

`apt install zsh`

`sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"`

References : https://github.com/robbyrussell/oh-my-zsh

Change your default shell

`chsh -s /bin/zsh`

manual update

`upgrade_oh_my_zsh`

Magic!

Themes Agnoster

References : https://github.com/robbyrussell/oh-my-zsh/wiki/Themes#agnoster

**Powerline installation**

`sudo apt-get install python-pip`

`pip -V`

References : https://powerline.readthedocs.io/en/latest/installation/linux.html#font-installation

`pip install powerline-status`

`pip install --user git+git://github.com/powerline/powerline`

`pip install --user --editable={path_to_powerline}`

`ln -s {path_to_powerline}/scripts/powerline ~/.local/bin`

**Fonts installation**

`wget https://github.com/powerline/powerline/raw/develop/font/PowerlineSymbols.otf`

`wget https://github.com/powerline/powerline/raw/develop/font/10-powerline-symbols.conf`

`sudo mkdir ~/.fonts/`

`mv PowerlineSymbols.otf ~/.fonts/`

`fc-cache -vf ~/.fonts/`

`sudo mkdir ~/.config/fontconfig/conf.d/`
if error create directory manual.

`mv 10-powerline-symbols.conf ~/.config/fontconfig/conf.d/`

References : https://github.com/powerline/fonts

`git clone https://github.com/powerline/fonts.git`

`cd fonts`

Run `./install.sh`

References : https://github.com/agnoster/agnoster-zsh-theme

------

>**NVM** - Node Version Manager - Simple bash script to manage multiple active node.js versions

References : https://github.com/creationix/nvm

**Install NVM**

`wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.1/install.sh | bash`

**Verify installation**

`command -v nvm`

**Manual Upgrade**

For manual upgrade with `git` (requires git v1.7+):

1. change to the `$NVM_DIR`
1. pull down the latest changes
1. check out the latest version
1. activate the new version

```sh
(
  cd "$NVM_DIR"
  git fetch origin
  git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" origin`
) && . "$NVM_DIR/nvm.sh"
```

**Usage**

To download, compile, and install the latest release of node, do this:

```sh
nvm install node
```

And then in any new shell just use the installed version:

```sh
nvm use node
```

Or you can just run it:

```sh
nvm run node --version
```
Or, you can run any arbitrary command in a subshell with the desired version of node:

```sh
nvm exec 4.2 node --version
```

You can also get the path to the executable to where it was installed:

```sh
nvm which 5.0
```

In place of a version pointer like "0.10" or "5.0" or "4.2.1", you can use the following special default aliases with `nvm install`, `nvm use`, `nvm run`, `nvm exec`, `nvm which`, etc:

 - `node`: this installs the latest version of [`node`](https://nodejs.org/en/)
 - `iojs`: this installs the latest version of [`io.js`](https://iojs.org/en/)
 - `stable`: this alias is deprecated, and only truly applies to `node` `v0.12` and earlier. Currently, this is an alias for `node`.
 - `unstable`: this alias points to `node` `v0.11` - the last "unstable" node release, since post-1.0, all node versions are stable. (in semver, versions communicate breakage, not stability).

------

**SQLite**

`sudo apt-get install sqlite3`

`sudo apt-get install sqlitebrowser`

**PostgreSql**

`sudo apt-get install postgresql`

**pgAdmin III available on software center**

pgAdmin III is a database design and management application for use with PostgreSQL. The application can be used to manage PostgreSQL 7.3 and above running on any platform.

**FileZilla**

`sudo apt-get install filezilla`

**Android Studio**

https://developer.android.com/studio/index.html

Solved : Unable to run mksdcard SDK tool.

`sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6`

**Xampp**

https://www.apachefriends.org/download.html

`sudo chmod +x xampp-linux-x64-7.1.1-0-installer.run`

`sudo ./xampp-linux-x64-7.1.1-0-installer.run`

`cd /opt/lampp`

`sudo ./manager-linux-x64.run`

Create Shortcut

`sudo gedit /usr/share/applications/xampp-control-panel.desktop`

```
[Desktop Entry]
Encoding=UTF-8
Name=XAMPP Control Panel
Comment=Start and Stop XAMPP
Exec=gksudo /opt/lampp/manager-linux-x64.run
Icon=/opt/lampp/htdocs/favicon.ico
Categories=Application
Type=Application
Terminal=false
```

`sudo apt-get update`

-------

## Troubleshooting

**If Touchpad not work normal**

`sudo modprobe -r psmouse`

`sudo modprobe psmouse proto=imps`

**if after reboot not working**

Here is something that fixed touchpad issues for me on some Dell Latitude e6220 laptops with TeaLinuxOS 8.1 versions.

`sudo mkdir /etc/X11/xorg.conf.d`

`cd /usr/share/X11/xorg.conf.d`

`sudo cp 50-synaptics.conf /etc/X11/xorg.conf`

`sudo cp 50-synaptics.conf /etc/X11/xorg.conf.d`

`cd /etc/X11/xorg.conf.d`

`sudo pico 50-synaptics.conf`

under the line saying "MatchDevicePath "/dev/input/event*" in the first "InputClass" section, insert these two lines:

```
# Enable ClickPad to fix drag/drop on some laptop models
Option    "ClickPad"   "1"

```

Save and exit editor and than reboot

**Get to default TeaLinuxOS lock screen After change the lock screen**

`sudo nano -B /etc/lightdm/lightdm.conf`

```
[SeatDefaults]
greeter-session=lightdm-gtk-greeter
```

**Sometimes fails to sleep**

To fix, try installing a new kernel.

Open your terminal then just copy paste the command

```
cd /tmp

wget \
kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/linux-headers-4.5.2-040502_4.5.2-040502.201604200335_all.deb \
kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/linux-headers-4.5.2-040502-generic_4.5.2-040502.201604200335_amd64.deb \
kernel.ubuntu.com/~kernel-ppa/mainline/v4.5.2-wily/linux-image-4.5.2-040502-generic_4.5.2-040502.201604200335_amd64.deb

sudo dpkg -i linux-headers-4.5*.deb linux-image-4.5*.deb

```

**NEW UPDATE from ELementary**

!!!!!!!!This is Not the oficial build!!!!!Do Not post Bugs
*******If u want to see the OS skip at 8:34******
U need Ubuntu 16.04

First step!

-------Terminal script--------
```
sudo add-apt-repository ppa:elementary-os/daily
sudo add-apt-repository ppa:elementary-os/testing
sudo add-apt-repository ppa:elementary-os/os-patches
sudo apt-get update
sudo apt-get dist-upgrade
sudo apt-get install elementary-desktop

```

Second Step!

Log out
Will leave the current session and we log in to our new Pantheon session.

To uninstall it will not be so easy

1) Enter your ubuntu session and change the default theme Ambiance your desktop for example.
2) Enter a terminal.
3) Type in the same:

-------Terminal script--------
```
sudo add-apt-repository -r ppa:elementary-os/daily
sudo add-apt-repository -r ppa:elementary-os/testing
sudo add-apt-repository -r ppa:elementary-os/os-patches
sudo apt-get update
sudo apt-get remove --purge libgranite-common pantheon* elementary*
sudo apt-get autoremove
sudo apt-get dist-upgrade
```
**About Grub**

Mengecek Menu entry di `/boot/grub/grub.cfg`
Mengedit Default Grub di `/etc/default/grub`
melakukan update grub dengan perintah `sudo grub-update`

## Permission

Directory permissions change "directory" and all of its contents.

`chmod 777 -R /directory`


text:
                <md-list>
                    <md-list-item class="md-2-line">

{{user.name}}

{{categoryName}}

                        <md-button class="md-primary md-raised" ng-disabled="checkPublish()" ng-click="publish($event)" ng-hide="loading">Publish</md-button>
                        <md-progress-circular md-diameter="40" ng-show="loading" md-mode="indeterminate"></md-progress-circular>
                        <md-tooltip ng-show="!(title && (mediumEditor || trix) && (mediumEditor.length>20 || trix.length>20) )" md-direction="bottom">Type min 20 characters.</md-tooltip>
                    </md-list-item>
                </md-list>
                <item-card ng-show="creativity.type"></item-card>

                    <p hide-xs show-gt-xs class="md-title" ng-hide="progress<1" style="outline: none; font-family: Georgia, Cambria, 'Times New Roman',Times,serif;letter-spacing: -.003em;" ng-model="mediumEditor" medium-editor data-placeholder="Tell your story...">

                    <div show-xs hide-gt-xs ng-hide="progress<1" ng-init="focus=false">
                        <trix-editor angular-trix id="trix-editor-1" ng-model="trix" placeholder="Tell your story..." class="trix-content md-title" style="border: none; font-family: Georgia, Cambria, 'Times New Roman',Times,serif;letter-spacing: -.003em;">
                        </trix-editor>

                <center ng-show="progress<1">

Choose the most appropriate category

                <div hide-xs style=" padding:0px" ng-repeat="itemgroup in items" flex layout="row" layout-align="center center" ng-show="progress<1">

                        <md-button class="interest" ng-checked="exists(item, selected)" ng-click="progress=1;selectType(item)">
                            {{ item.title }}
                        </md-button>

                <div hide-gt-xs style=" padding:0px" ng-repeat="itemgroup in itemsMobile" flex layout="row" layout-align="center center" ng-show="progress<1">

                        <md-button class="interest" ng-checked="exists(item, selected)" ng-click="progress=1;selectType(item)">
                            {{ item.title }}
                        </md-button>


text:
<?php

namespace Amadeus\Client\Struct\Ticket\CheckEligibility;

/**
 * TicketNumberDetails
 *
 * @package Amadeus\Client\Struct\Ticket\CheckEligibility
 * @author Dieter Devlieghere <dermikagh@gmail.com>
 */
class TicketNumberDetails
{
    /**
     * @var DocumentDetails[]
     */
    public $documentDetails = [];

    /**
     * TicketNumberDetails constructor.
     *
     * @param string[] $ticketNumbers
     */
    public function __construct(array $ticketNumbers)
    {
        foreach ($ticketNumbers as $ticketNumber) {
            $this->documentDetails[] = new DocumentDetails($ticketNumber);
        }
    }
}


text:
class CreateComments < ActiveRecord::Migration
  def change
    create_table :comments do |t|
      t.string  :comment
      t.integer :user_id, null: false
      t.integer :answer_id, :question_id
      t.integer :vote_val, default: 0
      t.timestamps
    end
  end
end


text:
package net.bourgau.philippe.concurrency.kata;

import net.bourgau.philippe.concurrency.kata.common.Output;

public class NullOutput implements Output {
    @Override
    public void write(String line) {
    }
}


text:
import React from 'react';
import DropMenu from './DropMenu';
import SignIn from './SignIn';
import SignUp from './SignUp';

import './SignInUp.scss';

function SignInUp() {
  return (

      <DropMenu button={() => sign in}>
        <SignIn />
      </DropMenu>
      <DropMenu button={() => sign up}>
        <SignUp />
      </DropMenu>

  );
}

export default SignInUp;


text:
#include "SceneMap.h"
#include "PathAStar.h"

SceneMap::SceneMap(int mapId) :mapId(mapId), _tileMap(NULL), _miniMap(NULL), m_delegate(NULL),
map(NULL)
{

}

SceneMap::~SceneMap()
{
	if (NULL != _tileMap)
	{
		CC_SAFE_DELETE(_tileMap);
	}
	if (NULL != map)
	{
		delete[] map;
		map = NULL;
	}
}

bool SceneMap::init()
{
	//¼ÓÔصØͼ
	CCString mapStr;
	mapStr.appendWithFormat("map/%d.tmx", this->mapId);
	_tileMap = TMXTiledMap::create(mapStr.getCString());
	this->addChild(_tileMap);
	this->updateMapPosition( Point(0,0) );

	//¼ÓÔصØͼ¾ØÕó
	CCTMXLayer * tmxLayer = _tileMap->layerNamed("barrier");
	tmxLayer->setVisible(false);
	Size mapSize = this->_tileMap->getMapSize();	//¶àÉÙ¿é
	Size tileSize = this->_tileMap->getTileSize();	//ÿ¿éµÄÏñËØ
	map = new unsigned char*[(int)mapSize.height];
	for (unsigned int i = 0; i<(int)mapSize.height; i++)
	{
		map[i] = new unsigned char[(int)mapSize.width];
		for (unsigned int j = 0; j < (int)mapSize.width; j++)
		{
			Sprite * grid = tmxLayer->tileAt(ccp(j, mapSize.height-1-i));
			if (NULL != grid)
			{
				map[i][j] = 1;
			}
			else
			{
				map[i][j] = 0;
			}

		}
	}

	CCLOG("[tiledMap load grid] :\n");
	for (unsigned int i = 0; i < (int)mapSize.height; i++)
	{
		string buff;
		for (unsigned int j = 0; j < (int)mapSize.width; j++)
		{
			buff += to_string(map[i][j]);
			buff += " ";
		}
		CCLOG("%s", buff.c_str());
	}

	//¼ÓÔØnpc
	CCTMXObjectGroup * npc = _tileMap->objectGroupNamed("npc");
	ValueVector values = npc->getObjects();
	for (ValueVector::iterator iter = values.begin(); iter != values.end(); iter++)
	{
		ValueMap valueMap = iter->asValueMap();
		float x = valueMap["x"].asFloat();
		float y = valueMap["y"].asFloat();
		int npcId = valueMap["npcid"].asInt();
		int path = valueMap["path"].asInt();

		NpcMapNode node;
		node.p = Point(x, y);
		node.npdId = npcId;
		node.path = path;

		this->m_npcList.push_back(node);
	}

	//¼ÓÔØminiµØͼ
	_miniMap = MiniMap::create(this->mapId);
	_miniMap->setDelegate(this);	//ÉèÖÃminiµØͼ¸üÐÂ'þ֪ͨÕß
	this->addChild(_miniMap);

	//¼ÓÔØplayer
	m_playerBornPoint.x = 100;
	m_playerBornPoint.z = 60;

	//µØͼÊó±êÏìÓ¦
	auto mouseListener = EventListenerMouse::create();
	mouseListener->onMouseDown = [this](EventMouse * event){

		do
		{
			float x = event->getCursorX(), y = event->getCursorY();
			CC_BREAK_IF(this->_miniMap->isContainPoint(x, y));
			CC_BREAK_IF(y < 100 || x>750);
			CC_BREAK_IF(this->m_delegate->isModal());

			MapPoint mp = this->getMapPointFromCusor( x, y);

			//×Ô¶¯Ñ°Â·
			Size mapSize = this->_tileMap->getMapSize();	//¶àÉÙ¿é
			Size tileSize = this->_tileMap->getTileSize();	//ÿ¿éµÄÏñËØ
			/*unsigned char ** map = new unsigned char*[(int)mapSize.height];
			for (unsigned int i = 0; i<(int)mapSize.height; i++)
			{
				map[i] = new unsigned char[(int)mapSize.width];
				for (unsigned int j = 0; j < (int)mapSize.width; j++)
				{
					map[i][j] = 0;
				}
			}*/

			MapPoint currentPoint(m_delegate->getPlayerPosition());

			CC_BREAK_IF(currentPoint == mp);

			std::deque<MapPoint> array = PathAStar::findPathByAStar(this->map,

				mapSize.width,
				mapSize.height,

				4096, currentPoint, mp);

			if (array.size() <= 0)	return;
			CCLOG("find");
			m_delegate->runMoveActions(array);

		} while (0);

	};
	mouseListener->onMouseUp = [this](EventMouse * event){};
	mouseListener->onMouseMove = [this](EventMouse * event){};
	mouseListener->onMouseScroll = [this](EventMouse * event){};

	_eventDispatcher->addEventListenerWithSceneGraphPriority(mouseListener, this);

	return true;
}

MapPoint SceneMap::getMapPointFromCusor(int cursorX, int cursorY)
{
	Point cusorPoint(cursorX, cursorY);
	Point mapPositon = this->_tileMap->getPosition();
	MapPoint mp(cusorPoint - mapPositon);
	return mp;
}

Point SceneMap::getScenePointFromMapPoint(MapPoint mp)
{
	Point p = mp.getCCPointValue();
	Point position = _tileMap->getPosition();
	return p + position;
}

SceneMap * SceneMap::create(int mapId)
{
	SceneMap* map = new SceneMap(mapId);
	if (map && map->init())
	{
		map->autorelease();
		return map;
	}
	CC_SAFE_DELETE(map);
	return NULL;
}

void SceneMap::updateFromMini(Point p, Point scale)	//´«¹ýÀ´µÄpÊÇÃÔÄãµØͼÖеÄ×ø±ê,scaleΪx,yµÄËõ·Å
{
	float sceneX = p.x / scale.x - winSize.width / 2;
	float sceneY = p.y / scale.y - winSize.height / 2;
	this->updateMapPosition(Point(sceneX, sceneY));
}

void SceneMap::updateMapPosition(Point p)	//²ÎÊýÊǵØͼµÄ×ø±ê£¬¶ø²»ÊǵØͼÔÚ³¡¾°µÄ×ø±ê
{
	Size mapSize = _tileMap->getMapSize();	//¶àÉÙ¿é
	Size tileSize = _tileMap->getTileSize();	//ÿ¿éµÄÏñËØ
	int tileMapWidth = mapSize.width * tileSize.width;
	int tileMapHeight = mapSize.height * tileSize.width;

	p.x = MAX(0, p.x);
	p.x = MIN(tileMapWidth - winSize.width, p.x);

	p.y = MAX(0, p.y);
	p.y = MIN(tileMapHeight - winSize.height, p.y);

	position.x = p.x;
	position.y = p.y;

	//ÉèÖÃÆ«ÒÆ
	_tileMap->setPosition(Point(-p.x, -p.y));

}


text:
#include "engine_t.h"
#include "gameobject.h"
#include "physics_particle.h"

using namespace EngineT;
class ParticlesManager : public GameObject2D
{

public:

    vector<PhysicsParticle*> particles;

    ParticlesManager();
    ~ParticlesManager();

    void Update();
};


text:
/**
 *
 */

;
(function($, window, document, undefined) {
	var pluginName = "multipleLineInputEditPanel";
	var defaults = {
		id : "",
		parent : "",
		entity : "",
		topparent : "",
		currowner : "",
	};

	var EditPanel = function(element, options) {
		this.element = element;
		this.options = $.extend({
			id : "",
			parent : "",
			entity : "",
			topparent : "",
			currowner : "",
		}, defaults, options);
		this._defaults = defaults;
		this._name = pluginName;
		this.init(options);
	};

	EditPanel.prototype.init = function(options) {
		this.loadPane(options.entity, 0, options.currowner);
	};

	EditPanel.prototype.loadPane = function(entity, tabindex, owner) {
		this.currtabindex = tabindex;

		var modalframe = document.createElement("div");
		this.element.appendChild(modalframe);

		var tabDIV = document.createElement("DIV");
		modalframe.appendChild(tabDIV);
		tabDIV.style.margin = "1px";

		var tabUL = document.createElement("UL");
		tabUL.className = "nav nav-tabs advanceproperty-nav-tabs";
		tabUL.id = "mul-input-props-nav-tabs";
		tabUL.setAttribute("role", "tablist");
		tabDIV.appendChild(tabUL);
		this.newTabHead(tabUL, 0, "高级属性", true);
		this.newTabHead(tabUL, 1, "组件关联", false);
		var that = this;
		$("#mul-input-props-nav-tabs").on("click", "a", function(e) {
			e.preventDefault();
			$(this).tab('show');
			that.currtabindex = parseInt($(this).attr('href').substring(4));
			if (that.currtabindex == 1) {
				if (!(owner instanceof ReleasedForm)) {
					that.options.parent.enableAddButton();
				}
			} else {
				that.options.parent.disabledAddButton();
			}
		});

		var tabContents = document.createElement("DIV");
		tabDIV.appendChild(tabContents);
		tabContents.className = "tab-content";
		tabContents.id = "advancedproptabs";

		this.tabContent1 = this.newTabContent(tabContents, 0, true);
		var plugin1 = $(this.tabContent1).multipleLineInputPropPane({
			id : "tab0",
			parent : this.options.parent,
			entity : entity,
			topparent : this.element,
			currowner : owner,
		});
		this.multipleInputPropPane = plugin1.data("multipleLineInputPropPane");

		this.tabContent2 = this.newTabContent(tabContents, 1, false);
		var plugin2 = $(this.tabContent2).multipleLineInputAssociatedPane({
			id : "tab1",
			parent : this.options.parent,
			entity : entity,
			topparent : this.element,
			currowner : owner,
		});
		this.multipleInputAssociatedPane = plugin2
				.data("multipleLineInputAssociatedPane");
		// by default
		$('#mul-input-props-nav-tabs a[href="#tab' + this.currtabindex + '"]')
				.tab('show');
		this.options.parent.disabledAddButton();
		this.options.parent.disabledRemoveButton();
	};

	EditPanel.prototype.newTabHead = function(parent, index, caption, active) {
		var tabLi = document.createElement("li");
		parent.appendChild(tabLi);
		if (active)
			tabLi.className = "active";
		tabLi.setAttribute("role", "presentation");
		var tabLink = document.createElement("a");
		tabLi.appendChild(tabLink);
		tabLink.setAttribute("href", "#tab" + index);
		tabLink.setAttribute("aria-controls", "tab" + index);
		tabLink.setAttribute("role", "tab");
		tabLink.setAttribute("data-toggle", "tab");
		tabLink.innerHTML = caption;
	};

	EditPanel.prototype.newTabContent = function(parent, index, active) {
		var tabContent = document.createElement("DIV");
		parent.appendChild(tabContent);
		tabContent.setAttribute("data", "tab" + index);
		tabContent.setAttribute("role", "tabpanel");
		if (active)
			tabContent.className = "tab-pane active";
		else
			tabContent.className = "tab-pane";
		tabContent.id = "tab" + index;
		return tabContent;
	};

	EditPanel.prototype.addRow = function(evt) {
		if (this.currtabindex == 1) {
			this.multipleInputAssociatedPane.addRow(evt);
		}
	};

	EditPanel.prototype.modifyRow = function(evt) {
	};

	EditPanel.prototype.removeRow = function(evt) {
		if (this.currtabindex == 1) {
			this.multipleInputAssociatedPane.removeRow(evt);
		}
	};

	$.fn[pluginName] = function(options) {
		return this.each(function() {
			if (!$.data(this, pluginName)) {
				$.data(this, pluginName, new EditPanel(this, options));
			} else if ($.isFunction(Plugin.prototype[options])) {
				$.data(this, pluginName)[options]();
			}
		});
	};

})(jQuery, window, document);


text:
from flask_table import Table, Col

# Declare your table
class ItemTable(Table):
    name = Col('Name')
    description = Col('Description')

# Get some objects
class Item(object):
    def __init__(self, name, description):
        self.name = name
        self.description = description

items = [Item('Name1', 'Description1'),
         Item('Name2', 'Description2'),
         Item('Name3', 'Description3')]
# Or, equivalently, some dicts
# items = [dict(name='Name1', description='Description1'),
#          dict(name='Name2', description='Description2'),
#          dict(name='Name3', description='Description3')]

# Or, more likely, load items from your database with something like
# items = ItemModel.query.all()

# Populate the table
table = ItemTable(items)

# Print the html
print(table.__html__())
# or just {{ table }} from within a Jinja template


text:
var _ = require('lodash');
var URI = require('../node_modules/URIjs/src/URI.js');
var request = require('../node_modules/superagent/superagent.js');
var Promise = require('es6-promise');

Promise = Promise.Promise; // unwrap

var PodioErrors = require('./PodioErrors');
var auth = require('./auth');

module.exports = {
  _getAuth: function() {
    // we have the auth object mixed in
    return this;
  },

  _addRequestData: function(data, method, req) {
    switch(method) {
      case 'get':
        if (!_.isEmpty(data)) {
          req = req.query(data);
        }
        break;
      case 'post':
      case 'put':
        if (!_.isEmpty(data)) {
          req = req.send(data);
        }
        break;
    }

    return req;
  },

  _addHeaders: function(req) {
    req = req.set('Authorization', 'OAuth2 ' + this.authObject.accessToken);

    return req;
  },

  _addCORS: function(req) {
    if (this.authType === 'client') {
      req = req.withCredentials();
    }

    return req;
  },

  _setOptions: function(options, req) {
    if (options.type && options.type === 'form') {
      req.type('form');
    }

    if (options.basicAuth) {
      req.set(
        'Authorization',
        'Basic ' + new Buffer(this.clientId + ':' + this.clientSecret).toString('base64')
      );
    }

    return req;
  },

  _onTokenRefreshed: function(request) {
    if (request.requestType === 'generic') {
      return this.request(request.method, request.path, request.data);
    } else if (request.requestType === 'file') {
      return this.uploadFile(request.filePath, request.fileName);
    }
  },

  _handleTransportError: function(options, response) {
    var request = options.requestParams;

    if (!response) {
      return new PodioErrors.PodioError(null, null, request.url);
    }

    switch(response.status) {
      case 400:
        return new PodioErrors.PodioBadRequestError(response.body, response.status, request.url);
      case 401:
        this._getAuth()._clearAuthentication();
        return new PodioErrors.PodioAuthorizationError(response.body, response.status, request.url);
      case 403:
        return new PodioErrors.PodioForbiddenError(response.body, response.status, request.url);
      case 404:
        return new PodioErrors.PodioNotFoundError(response.body, response.status, request.url);
      case 409:
        return new PodioErrors.PodioConflictError(response.body, response.status, request.url);
      case 410:
        return new PodioErrors.PodioGoneError(response.body, response.status, request.url);
      case 420:
        return new PodioErrors.PodioRateLimitError(response.body, response.status, request.url);
      case 500:
        return new PodioErrors.PodioServerError(response.body, response.status, request.url);
      case 502:
      case 503:
      case 504:
        return new PodioErrors.PodioUnavailableError(response.body, response.status, request.url);
      default:
        return new PodioErrors.PodioError(response.body, response.status, request.url);
    }
  },

  _onResponse: function(options, err, res) {
    if (res && res.ok === true && !err) {
      options.resolve(res.body);
    } else {
      var isStatus401 = res && res.status === 401;
      var isInvalidOrExpiredToken = (res.body.error === 'invalid_token' || res.body.error_description === 'expired_token');
      var hasRefreshToken = this.authObject && this.authObject.refreshToken;

      if (isStatus401 && isInvalidOrExpiredToken && hasRefreshToken) {

        this._getAuth()._refreshToken(function (err, response) {
          if (err !== null) {
            options.reject(this._handleTransportError(options, response));
          }

          if (_.isFunction(this.afterTokenRefreshed)) {
            this.afterTokenRefreshed(response);
          }

          this._onTokenRefreshed(options.requestParams).then(function (response) {
            options.resolve(response);
          }, function (err) {
            options.reject(err);
          })
        }.bind(this));
      } else {
        options.reject(this._handleTransportError(options, res));
      }
    }
  },

  _getRequestObject: function() {
    return request;
  },

  _formatMethod: function(method) {
    method = method.toLowerCase();

    if (method === 'delete') {
      return 'del';
    } else {
      return method;
    }
  },

  _getRequestURI: function(path) {
    var parsed = URI.parse(path);
    var uri = new URI(this.apiURL);

    uri.path(parsed.path);

    if (!_.isUndefined(parsed.query)) {
      uri.query(parsed.query);
    }

    return uri.toString();
  },

  request: function(method, path, data, options) {
    var url = this._getRequestURI(path);
    var request = this._getRequestObject();
    var req;

    if ((!options || !options.basicAuth) && !this.authObject) {
      return new Promise(function (resolve, reject) {
        reject(new PodioErrors.PodioForbiddenError('Authentication has not been performed'))
      });
    }

    method = this._formatMethod(method);

    req = request[method](url);

    if (options && options.basicAuth) {
      req = _.compose(
        this._addRequestData.bind(this, data, method),
        this._setOptions.bind(this, options || {})
      )(req);
    } else {
      req = _.compose(
        this._addRequestData.bind(this, data, method),
        this._addHeaders.bind(this),
        this._addCORS.bind(this),
        this._setOptions.bind(this, options || {})
      )(req);
    }

    return new Promise(function(resolve, reject) {
      var options = {
        resolve: resolve,
        reject: reject,
        requestParams: {
          requestType: 'generic',
          url: url,
          path: path,
          data: data,
          method: method
        }
      };

      req.end(this._onResponse.bind(this, options));
    }.bind(this));
  },

  uploadFile: function(filePath, fileName) {
    var url = new URI(this.apiURL).path('/file').toString();
    var req;

    if (!_.include(['server', 'password'], this.authType)) {
      return new Promise(function(resolve, reject) {
        reject(new PodioErrors.PodioError('File uploads are only supported on the server right now.'));
      });
    }

    req = this._getRequestObject().post(url).attach('source', filePath).field('filename', fileName);

    req = _.compose(this._addHeaders.bind(this), this._addCORS.bind(this))(req);

    return new Promise(function(resolve, reject) {
      var options = {
        resolve: resolve,
        reject: reject,
        requestParams: {
          requestType: 'file',
          filePath: filePath,
          fileName: fileName
        }
      };

      req.end(this._onResponse.bind(this, options));
    }.bind(this));
  }
};


text:
using MzLibUtil;
using System;
using System.Collections.Generic;
using System.Linq;

namespace EngineLayer
{
    public class IntervalMassDiffAcceptor : MassDiffAcceptor
    {
        private readonly List<DoubleRange> Intervals;
        private readonly double[] Means;

        public IntervalMassDiffAcceptor(string fileNameAddition, IEnumerable<DoubleRange> doubleRanges) : base(fileNameAddition)
        {
            Intervals = doubleRanges.OrderBy(b => b.Mean).ToList();
            Means = Intervals.Select(b => b.Mean).ToArray();
        }

        public override int Accepts(double scanPrecursorMass, double peptideMass)
        {
            double diff = scanPrecursorMass - peptideMass;

            int index = Array.BinarySearch(Means, diff);
            if (index >= 0)
                return 0;
            index = ~index;
            // Two options: either it's the index of the first element greater than diff, or len if diff greater than all
            if (index < Means.Length && Intervals[index].Contains(diff))
                return 0;
            if (index > 0 && Intervals[index - 1].Contains(diff))
                return 0;
            return -1;
        }

        public override IEnumerable<AllowedIntervalWithNotch> GetAllowedPrecursorMassIntervalsFromTheoreticalMass(double peptideMonoisotopicMass)
        {
            return Intervals.Select(b => new AllowedIntervalWithNotch(new DoubleRange(peptideMonoisotopicMass + b.Minimum, peptideMonoisotopicMass + b.Maximum), 0));
        }

        public override IEnumerable<AllowedIntervalWithNotch> GetAllowedPrecursorMassIntervalsFromObservedMass(double peptideMonoisotopicMass)
        {
            return Intervals.Select(b => new AllowedIntervalWithNotch(new DoubleRange(peptideMonoisotopicMass - b.Maximum, peptideMonoisotopicMass - b.Minimum), 0));
        }

        public override string ToString()
        {
            return FileNameAddition + " interval " + string.Join(",", Intervals);
        }

        public override string ToProseString()
        {
            return ("the mass (Da) interval(s) " + String.Join(", ", Intervals));
        }
    }
}


text:
package xal.extension.jels.tools.math;

/**
 * @author Ivo List
 * @author Juan F. Esteban Müller <juanf.estebanmuller@esss.se>
 */
public class MeanFieldPolynomial extends InverseRealPolynomial {

    private final InverseRealPolynomial TTF;
    private final InverseRealPolynomial TTFPrime;

    public MeanFieldPolynomial(InverseRealPolynomial TTF, InverseRealPolynomial TTFPrime) {
        this.TTF = TTF;
        this.TTFPrime = TTFPrime;
    }

    @Override
    public double evaluateAt(double dblVal) {
        return TTF.evaluateAt(dblVal);
    }

    @Override
    public double derivativeAt(double dblVal) {
        // If TTFPrime coefficients are not provided, it uses TTF
        if (TTFPrime.getCoef(0) != 0) {
            return 0.01 * TTFPrime.evaluateAt(dblVal);
        } else {
            return TTF.derivativeAt(dblVal);
        }
    }

    // TODO: return coefficients of all polynomials
    @Override
    public double getCoef(int iOrder) {

        return TTF.getCoef(iOrder);
    }
}


text:
layout: post
title: Video - Bitcoin Q and A Help Re-Decentralise Mining
description: Video - Bitcoin Q and A Help Re-Decentralise Mining
author: Andreas M. Antonopoulos
authorurl: /andreas-antonopoulos-bitcoin-expert/
published: true
---

The problem of mining centralization, anti-fragility with decentralization of computing power. How centralization occurred through advancements in mining hardware engineering and connections to silicon fabrication (100-10,000x performance increase). The factor of racism in worries about centralization. Impact of 16nm technology in computer processing and performance, Moore's Wall.

TRANSCRIPT


text:
package org.kohsuke.stapler;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Implements a RequestDispatcher for a given model node and view. Unlike dispatchers created through
 * {@link Facet#createValidatingDispatcher(AbstractTearOff, ScriptExecutor)}, these dispatchers always allow scripts
 * to be dispatched.
 * @param <S> script view type
 * @since TODO
 */
class ScriptRequestDispatcher<S> implements RequestDispatcher {

    private static final Logger LOGGER = Logger.getLogger(ScriptRequestDispatcher.class.getName());

    @CheckForNull static <S> ScriptRequestDispatcher<S> newRequestDispatcher(@NonNull AbstractTearOff<?, ? extends S, ?> scriptLoader,
                                                                             @NonNull ScriptExecutor<? super S> scriptExecutor,
                                                                             @NonNull String viewName,
                                                                             @CheckForNull Object node) {
        S script;
        try {
            script = scriptLoader.findScript(viewName);
        } catch (Exception e) {
            LOGGER.log(Level.WARNING, e, () -> "Could not load requested view " + viewName + " on model class " + (node == null ? null : node.getClass().getName()));
            return null;
        }
        if (script == null) {
            return null;
        }
        return new ScriptRequestDispatcher<>(scriptLoader.getDefaultScriptExtension(), scriptExecutor, viewName, script, node);
    }

    private final @NonNull String defaultScriptExtension;
    private final @NonNull ScriptExecutor<? super S> scriptExecutor;
    private final @NonNull String viewName;
    private final @NonNull S script;
    private final @CheckForNull Object node;

    private ScriptRequestDispatcher(@NonNull String defaultScriptExtension,
                                    @NonNull ScriptExecutor<? super S> scriptExecutor,
                                    @NonNull String viewName,
                                    @NonNull S script,
                                    @CheckForNull Object node) {
        this.defaultScriptExtension = defaultScriptExtension;
        this.scriptExecutor = scriptExecutor;
        this.viewName = viewName;
        this.script = script;
        this.node = node;
    }

    @Override
    public void forward(ServletRequest request, ServletResponse response) throws ServletException, IOException {
        StaplerRequest req = (StaplerRequest) request;
        StaplerResponse rsp = (StaplerResponse) response;
        DispatchValidator validator = req.getWebApp().getDispatchValidator();
        validator.allowDispatch(req, rsp);
        try {
            Dispatcher.anonymizedTraceEval(req, rsp, node, "%s: View: %s%s", viewName, defaultScriptExtension);
            if (Dispatcher.traceable()) {
                Dispatcher.trace(req, rsp, "-> %s on <%s>", viewName, node);
            }
            scriptExecutor.execute(req, rsp, script, node);
        } catch (ServletException | IOException | RuntimeException e) {
            throw e;
        } catch (Exception e) {
            throw new ServletException(e);
        }

    }

    @Override
    @SuppressFBWarnings(value = "REQUESTDISPATCHER_FILE_DISCLOSURE", justification = "Forwarding the request to be handled correctly.")
    public void include(ServletRequest request, ServletResponse response) throws ServletException, IOException {
        forward(request, response);
    }
}


text:
package com.feilong.core.lang.reflect;

import java.lang.reflect.Method;

import org.apache.commons.lang3.Validate;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.feilong.core.lang.ClassUtil;
import com.feilong.tools.slf4j.Slf4jUtil;

/**
 * 使用反射的方式执行调用bean中的方法.
 *
 *
方法介绍:

 *
 *

 *
 *

 * 这两个是调用常规方法的
 *

 *
 *

 *
{@link #invokeMethod(Object, String, Object...)}

 *
{@link #invokeMethod(Object, String, Object[], Class[])}

 *

 *
 *

 * 注意,底层调用的是 {@link org.apache.commons.lang3.reflect.MethodUtils#invokeMethod(Object, String, Object[], Class[]) MethodUtils.invokeMethod}
 * ,这个方法会调用
 * {@link org.apache.commons.lang3.reflect.MethodUtils#getMatchingAccessibleMethod(Class, String, Class...)
 * MethodUtils.getMatchingAccessibleMethod}获得最佳匹配方法
 *
 *

 * 下面两个是调用静态方法的:
 *

 *
 *

 *
{@link #invokeStaticMethod(Class, String, Object...)}

 *
{@link #invokeStaticMethod(Class, String, Object[], Class[])}

 *

 *
 *

 *
 *
关于 {@link org.apache.commons.lang3.reflect.MethodUtils MethodUtils}:

 *

 *
 *

 * 如果你要调用精准的方法,可以使用 {@link org.apache.commons.lang3.reflect.MethodUtils MethodUtils}原生方法:
 *

 *
 *

 *
{@link MethodUtils#invokeExactMethod(Object, String)}

 *
{@link MethodUtils#invokeExactMethod(Object, String, Object...)}

 *
{@link MethodUtils#invokeExactMethod(Object, String, Object[], Class[])}

 *
{@link MethodUtils#invokeExactStaticMethod(Class, String, Object...)}

 *
{@link MethodUtils#invokeExactStaticMethod(Class, String, Object[], Class[])}

 *

 *
 *

 * 当然,你还可以调用 {@link org.apache.commons.lang3.reflect.MethodUtils MethodUtils}其他方法:
 *

 *
 *

 *
{@link MethodUtils#getAccessibleMethod(java.lang.reflect.Method)}

 *
{@link MethodUtils#getAccessibleMethod(Class, String, Class...)}

 *
{@link MethodUtils#getMatchingAccessibleMethod(Class, String, Class...)}

 *
{@link MethodUtils#getMethodsListWithAnnotation(Class, Class)} 获得一个类中,指定泛型的方法(集合形式),比较实用

 *
{@link MethodUtils#getMethodsWithAnnotation(Class, Class)} 获得一个类中,指定泛型的方法(数组形式),比较实用

 *
{@link MethodUtils#getOverrideHierarchy(java.lang.reflect.Method, org.apache.commons.lang3.ClassUtils.Interfaces)}

 *

 *
 *

 *
 *

 * 当然,您也可以调用 java 原生态, 需要注意的是:
 *

 *
 *

 *

 *

 * 方法
 * 说明
 *

 *
 *

 * {@link Class#getMethods()}
 *
 * 返回一个包含某些 Method 对象的数组,
 *
 *

 * 反映此 Class 所表示的类或接口(包括由该类或接口声明的以及继承的类或接口)的公共(public) member
 * 方法.

 *

 *
 * 返回数组中的元素没有排序.

 *
 * 如果类声明了带有相同参数类型的多个公共成员方法,则它们都会包含在返回的数组中.

 * 如果此 Class 对象表示没有公共成员方法的类或接口,或者表示一个基本类型或 void,则此方法返回长度为 0 的数组.

 * 类初始化方法<clinit> 不包含在返回的数组中.
 *

 *
 *

 * {@link Class#getDeclaredMethods()}
 *
 * 返回 Method 对象的一个数组,
 *
 *

 * 反映此 Class 对象表示的类或接口声明的所有方法,

 * 包括公共(public)
 * 、保护(protected)
 * 、默认(包)访问(default (package) access)
 * 和私有方法(private)
 * ,

 * 但 不包括继承(inherited)的方法.
 *

 * 如果该类声明带有相同参数类型的多个公共成员方法,则它们都包含在返回的数组中.
 *

 *
 * 返回数组中的元素没有排序.
 *
 *

 * 如果该类或接口不声明任何方法,或者此 Class 对象表示一个基本类型、一个数组类或 void,则此方法返回一个长度为 0 的数组.

 * 类初始化方法<clinit> 包含在返回数组中.

 *
 *

 *
 *

 *

 *
 * @author feilong
 * @see org.apache.commons.lang3.reflect.MethodUtils
 * @see org.apache.commons.lang3.ClassUtils#getPublicMethod(Class, String, Class...)
 * @see java.util.ServiceLoader jdk1.6 ServiceLoader
 * @since 1.0.7
 */
public final class MethodUtil{

    /** The Constant log. */
    private static final Logger LOGGER = LoggerFactory.getLogger(MethodUtil.class);

    //---------------------------------------------------------------

    /** Don't let anyone instantiate this class. */
    private MethodUtil(){
        //AssertionError不是必须的. 但它可以避免不小心在类的内部调用构造器. 保证该类在任何情况下都不会被实例化.
        //see 《Effective Java》 2nd
        throw new AssertionError("No " + getClass().getName() + " instances for you!");
    }

    //---------------------------------------------------------------

    // [start]

    /**
     * 执行指定对象 object 的指定方法 methodName.
     *
     *
说明:

     *

     *

     *
使用场景:适合比如上传下载 service有很多相同类型的方法,比如 importXX1,importXX2,对于这种,可以使用调用此方法来快速调用方法

     *
支持调用对象父类方法

     *
也支持调用自己对象或者父类的静态方法,结果相似于 {@link #invokeStaticMethod(Class, String, Object...)},除了参数不同,一个是对象,一个是class,不过通常不建议这么使用

     *
调用的是 {@link MethodUtils#invokeMethod(Object, String, Object...)},内部调用的是 {@link java.lang.Class#getMethods()}来处理,不支持
     * 调用private 方法

     *
params将会转成包装类型来寻找method
     *
     *
示例:

     *
     *

     *
     *

     * 如有以下的
     *

     *
     *

     *
     * public class OverloadMethod{
     *
     *     public String age(int age){
     *         return "age int:" + age;
     *     }
     *
     *     public String age(Integer age){
     *         return "age Integer:" + age;
     *     }
     * }
     *
     *

     *
     * 测试调用
     *
     *

     *
     * public void testInvokeMethod(){
     *     LOGGER.debug("" + MethodUtil.invokeMethod(new OverloadMethod(), "age", 5));
     *     LOGGER.debug("" + MethodUtil.invokeMethod(new OverloadMethod(), "age", Integer.parseInt("5")));
     * }
     *

     *
     * 结果都是:
     *
     *

     * age Integer:5
     * age Integer:5
     *

     *
     *

     *

     *
如果你要精准调用,请使用 {@link #invokeMethod(Object, String, Object[], Class[])}
     *
     *
示例:

     *
     *

     *
     *

     *
     * Class{@code <?>}[] parameterTypes1 = { Integer.TYPE };
     * assertEquals("age int:5", MethodUtil.invokeMethod(new OverloadMethod(), "age", toArray(5), parameterTypes1));
     *
     *

     *
     *

     *

     *

     *
     * @param <T>
     *            the generic type
     * @param obj
     *            对象
     * @param methodName
     *            方法名
     * @param params
     *            参数
     * @return 如果 obj 是null,抛出 {@link NullPointerException}

     *         如果 methodName 是null,抛出 {@link NullPointerException}

     *         如果 methodName 是blank,抛出 {@link IllegalArgumentException}

     *         如果 obj没有指定的methodName方法,抛出 {@link ReflectException}

     *         如果 params 是null,系统内部会使用 empty 的class 数组

     *         如果 params 是empty,表示不需要参数

     * @see java.lang.reflect.Method#invoke(Object, Object...)
     * @see com.feilong.core.lang.ClassUtil#toClass(Object...)
     * @see org.apache.commons.lang3.reflect.MethodUtils#invokeMethod(Object, String, Object...)
     * @see org.apache.commons.lang3.reflect.MethodUtils#getMatchingAccessibleMethod(Class, String, Class...)
     */
    public static <T> T invokeMethod(Object obj,String methodName,Object...params){
        Validate.notNull(obj, "obj can't be null!");
        Validate.notBlank(methodName, "methodName can't be blank!");

        final Class<?>[] parameterTypes = ClassUtil.toClass(params);
        return invokeMethod(obj, methodName, params, parameterTypes);
    }

    //---------------------------------------------------------------

    /**
     * 执行指定对象 object 的指定方法 methodName.
     *
     *
说明:

     *

     *

     *
使用场景:适合比如上传下载 service有很多相同类型的方法,比如 importXX1,importXX2,对于这种,可以使用调用此方法来快速调用方法

     *
支持调用对象父类方法

     *
也支持调用自己对象或者父类的静态方法,结果相似于 {@link #invokeStaticMethod(Class, String, Object[], Class[])},除了参数不同,一个是对象,一个是class,不过通常不建议这么使用

     *
调用的是 {@link MethodUtils#invokeMethod(Object, String, Object...)},内部调用的是 {@link java.lang.Class#getMethods()}来处理,不支持
     * 调用private 方法

     *

     *

     *
     *
     *
示例:

     *
     *

     *
     *

     * 如有以下的
     *

     *
     *

     *
     * public class OverloadMethod{
     *
     *     public String age(int age){
     *         return "age int:" + age;
     *     }
     *
     *     public String age(Integer age){
     *         return "age Integer:" + age;
     *     }
     * }
     *
     *

     *
     *

     * 测试调用
     *

     *
     *

     *
     * Class{@code <?>}[] parameterTypes1 = { Integer.TYPE };
     * assertEquals("age int:5", MethodUtil.invokeMethod(new OverloadMethod(), "age", toArray(5), parameterTypes1));
     *
     * Class{@code <?>}[] parameterTypes2 = { Integer.class };
     * assertEquals("age Integer:5", MethodUtil.invokeMethod(new OverloadMethod(), "age", toArray(Integer.parseInt("5")), parameterTypes2));
     *
     *

     *
     *

     *
     * @param <T>
     *            the generic type
     * @param object
     *            the object
     * @param methodName
     *            the method name
     * @param args
     *            the args
     * @param parameterTypes
     *            the parameter types
     * @return 如果 object 是null,抛出 {@link NullPointerException}

     *         如果 methodName 是null,抛出 {@link NullPointerException}

     *         如果 methodName 是blank,抛出 {@link IllegalArgumentException}

     *         如果 obj没有指定的methodName方法,抛出 {@link ReflectException}

     *         如果 parameterTypes 是null,系统内部会使用 empty 的class 数组

     *         如果 parameterTypes 是empty,表示不需要参数

     * @see org.apache.commons.lang3.reflect.MethodUtils#invokeMethod(Object, String, Object[], Class[])
     * @see org.apache.commons.lang3.reflect.MethodUtils#getMatchingAccessibleMethod(Class, String, Class...)
     * @since 1.1.1
     */
    @SuppressWarnings("unchecked")
    public static <T> T invokeMethod(final Object object,final String methodName,Object[] args,Class<?>[] parameterTypes){
        Validate.notNull(object, "object can't be null!");
        Validate.notBlank(methodName, "methodName can't be blank!");

        //---------------------------------------------------------------
        try{
            return (T) MethodUtils.invokeMethod(object, methodName, args, parameterTypes);
        }catch (Exception e){
            String pattern = "invokeMethod Exception,object:[{}],methodName:[{}],args:[{}],parameterTypes:[{}]";
            String message = Slf4jUtil.format(pattern, object, methodName, args, parameterTypes);
            throw new ReflectException(message, e);
        }
    }

    //---------------------------------------------------------------

    /**
     * 执行指定类型 klass 的指定静态方法 staticMethodName (同时支持 私有静态方法).
     *
     *
说明:

     *

     *

     *
支持调用对象父类静态方法

     *
不可以调用非静态的方法

     *
支持调用私有的静态的方法(since 1.11.5 )

     *
params将会转成包装类型来寻找method

     *

     *

     *
     *
注意 :

     *

     *

     *
{@link MethodUtils#invokeStaticMethod(Class, String, Object[], Class[])} 内部调用的是 {@link java.lang.Class#getMethods()}来处理,
     * 直接使用的话,不支持 调用 private 方法

     *
     *
该方法进行容错处理,如果{@link MethodUtils#invokeStaticMethod(Class, String, Object[], Class[])} 找不到对应的 公共的静态方法, 将会去尝试找私有额静态方法

     *

     *

     *
     *
示例:

     *
     *

     *
     *

     * 如有以下的
     *

     *
     *

     *
     * public class OverloadStaticMethod{
     *
     *     public static String age(int age){
     *         return "static age int:" + age;
     *     }
     *
     *     public static String age(Integer age){
     *         return "static age Integer:" + age;
     *     }
     * }
     *
     *

     *
     * 测试调用
     *
     *

     * MethodUtil.invokeStaticMethod(OverloadStaticMethod.class, "age", 5);
     * MethodUtil.invokeStaticMethod(OverloadStaticMethod.class, "age", Integer.parseInt("5"));
     *

     *
     * 结果都是:
     *
     *

     * static age Integer:5
     * static age Integer:5
     *

     *
     *

     *
     *
     *

     * 如果你要精准调用,请使用 {@link #invokeStaticMethod(Class, String, Object[], Class[])}
     *

     *
     *
示例:

     *
     *

     *
     *

     * Class{@code <?>}[] parameterTypes1 = { Integer.TYPE };
     * assertEquals("static age int:5", MethodUtil.invokeStaticMethod(OverloadStaticMethod.class, "age", toArray(5), parameterTypes1));
     *
     * Class{@code <?>}[] parameterTypes2 = { Integer.class };
     * assertEquals(
     *                 "static age Integer:5",
     *                 MethodUtil.invokeStaticMethod(OverloadStaticMethod.class, "age", toArray(Integer.parseInt("5")), parameterTypes2));
     *

     *
     *

     *
     *
     * @param <T>
     *            the generic type
     * @param klass
     *            the klass
     * @param staticMethodName
     *            静态方法名
     * @param params
     *            动态参数
     * @return 如果 klass 是null,抛出 {@link NullPointerException}

     *         如果 staticMethodName 是null,抛出 {@link NullPointerException}

     *         如果 staticMethodName 是blank,抛出 {@link IllegalArgumentException}

     *         如果 staticMethodName 是实例方法,非静态方法,抛出 {@link ReflectException}

     *         如果 klass没有指定的staticMethodName方法,抛出 {@link ReflectException}

     *         如果 parameterTypes 是null,系统内部会使用 empty 的class 数组

     *         如果 parameterTypes 是empty,表示不需要参数

     * @see java.lang.reflect.Method#invoke(Object, Object...)
     * @see org.apache.commons.lang3.reflect.MethodUtils#invokeStaticMethod(Class, String, Object...)
     */
    public static <T> T invokeStaticMethod(Class<?> klass,String staticMethodName,Object...params){
        final Class<?>[] parameterTypes = ClassUtil.toClass(params);
        return invokeStaticMethod(klass, staticMethodName, params, parameterTypes);
    }

    /**
     * 执行指定类型 klass 的指定静态方法 staticMethodName (同时支持 私有静态方法).
     *
     *
说明:

     *

     *

     *
支持调用对象父类静态方法

     *
不可以调用非静态的方法

     *
支持调用私有的静态的方法(since 1.11.5 )

     *

     *

     *
     *
注意 :

     *

     *

     *
{@link MethodUtils#invokeStaticMethod(Class, String, Object[], Class[])} 内部调用的是 {@link java.lang.Class#getMethods()}来处理,
     * 直接使用的话,不支持 调用 private 方法

     *
     *
该方法进行容错处理,如果{@link MethodUtils#invokeStaticMethod(Class, String, Object[], Class[])} 找不到对应的 公共的静态方法, 将会去尝试找私有额静态方法

     *

     *

     *
     *
示例:

     *
     *

     *
     *

     * 如有以下的
     *

     *
     *

     *
     * public class OverloadStaticMethod{
     *
     *     public static String age(int age){
     *         return "static age int:" + age;
     *     }
     *
     *     public static String age(Integer age){
     *         return "static age Integer:" + age;
     *     }
     * }
     *
     *

     *
     * 测试调用
     *
     *

     * Class{@code <?>}[] parameterTypes1 = { Integer.TYPE };
     * assertEquals("static age int:5", MethodUtil.invokeStaticMethod(OverloadStaticMethod.class, "age", toArray(5), parameterTypes1));
     *
     * Class{@code <?>}[] parameterTypes2 = { Integer.class };
     * assertEquals(
     *                 "static age Integer:5",
     *                 MethodUtil.invokeStaticMethod(OverloadStaticMethod.class, "age", toArray(Integer.parseInt("5")), parameterTypes2));
     *
     *

     *
     *

     *
     * @param <T>
     *            the generic type
     * @param klass
     *            the klass
     * @param staticMethodName
     *            静态方法名
     * @param args
     *            the args
     * @param parameterTypes
     *            the parameter types
     * @return 如果 klass 是null,抛出 {@link NullPointerException}

     *         如果 staticMethodName 是null,抛出 {@link NullPointerException}

     *         如果 staticMethodName 是blank,抛出 {@link IllegalArgumentException}

     *         如果 staticMethodName 是实例方法,非静态方法,抛出 {@link ReflectException}

     *         如果 klass没有指定的staticMethodName方法,抛出 {@link ReflectException}

     *         如果 parameterTypes 是null,系统内部会使用 empty 的class 数组

     *         如果 parameterTypes 是empty,表示不需要参数

     * @see org.apache.commons.lang3.reflect.MethodUtils#invokeStaticMethod(Class, String, Object[], Class[])
     * @since 1.1.1
     */
    @SuppressWarnings("unchecked")
    public static <T> T invokeStaticMethod(final Class<?> klass,final String staticMethodName,Object[] args,Class<?>[] parameterTypes){
        Validate.notNull(klass, "klass can't be null!");
        Validate.notBlank(staticMethodName, "staticMethodName can't be blank!");
        //---------------------------------------------------------------
        try{
            return (T) MethodUtils.invokeStaticMethod(klass, staticMethodName, args, parameterTypes);
        }catch (NoSuchMethodException e){
            LOGGER.trace(
                            "from class:[{}],can't find [public static {}()] method,cause exception: [{}],will try to find [private static] method",
                            klass.getSimpleName(),
                            staticMethodName,
                            e);
            //---------------------------------------------------------------
            return doWithNoSuchMethodException(klass, staticMethodName, args, parameterTypes);
        }catch (Exception e){
            throw new ReflectException(buildMessage(klass, staticMethodName, args, parameterTypes), e);
        }
    }

    //---------------------------------------------------------------

    /**
     * Do with no such method exception.
     *
     * @param <T>
     *            the generic type
     * @param klass
     *            the klass
     * @param staticMethodName
     *            the static method name
     * @param args
     *            the args
     * @param parameterTypes
     *            the parameter types
     * @return the t
     * @throws ReflectException
     *             the reflect exception
     * @since 1.11.5
     */
    @SuppressWarnings("unchecked")
    private static <T> T doWithNoSuchMethodException(Class<?> klass,String staticMethodName,Object[] args,Class<?>[] parameterTypes){
        try{
            Method matchingMethod = MethodUtils.getMatchingMethod(klass, staticMethodName, parameterTypes);
            if (null == matchingMethod){
                throw new NoSuchMethodException("No such method:[" + staticMethodName + "()] on class: " + klass.getName());
            }

            //---------------------------------------------------------------

            if (LOGGER.isDebugEnabled()){
                LOGGER.debug("bingo,from class:[{}],find name [{}] method", klass.getSimpleName(), staticMethodName);
            }

            //---------------------------------------------------------------
            matchingMethod.setAccessible(true);
            return (T) matchingMethod.invoke(null, args);
        }catch (Exception e){
            throw new ReflectException(buildMessage(klass, staticMethodName, args, parameterTypes), e);
        }
    }

    //---------------------------------------------------------------

    /**
     * Builds the message.
     *
     * @param klass
     *            the klass
     * @param staticMethodName
     *            the static method name
     * @param args
     *            the args
     * @param parameterTypes
     *            the parameter types
     * @return the string
     */
    private static String buildMessage(Class<?> klass,String staticMethodName,Object[] args,Class<?>[] parameterTypes){
        String pattern = "invokeStaticMethod Exception,class:[{}],staticMethodName:[{}],args:[{}],parameterTypes:[{}]";
        return Slf4jUtil.format(pattern, klass.getName(), staticMethodName, args, parameterTypes);
    }
}


text:
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Queue Manager @yield('title')</title>
<link rel="icon" href="{!! asset('images/fav-icon.png') !!}"/>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity=
"sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

{{ Html::style('css/styles.css') }}

@yield('style')

<!-- Fonts -->
{{--
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css"
      integrity="sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+" crossorigin="anonymous">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700">
--}}
{{--<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/slate/bootstrap.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/slate/bootstrap.min.css">--}}{{--

<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<!-- Styles -->
<link href="https://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"
      integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
--}}
{{-- <link href="{{ elixir('css/app.css') }}" rel="stylesheet"> --}}{{--

<!-- Carousel -->
--}}
{{--<link type="text/css" rel="stylesheet" href="css/lightslider.css" />--}}{{--

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
--}}
{{--<script src="js/lightslider.js"></script>--}}{{--

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightslider/1.1.6/css/lightslider.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.min.css.map">

<script src="https://cdnjs.cloudflare.com/ajax/libs/lightslider/1.1.6/js/lightslider.js"></script>
--}}

<!-- Fonts -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css" integrity="sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+" crossorigin="anonymous">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700">

<!-- Styles -->
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://fortawesome.github.io/Font-Awesome/assets/font-awesome/css/font-awesome.css" rel="stylesheet">
{{--<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"/>--}}
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick-theme.css">
<link rel="stylesheet" type="text/css" href="sss/styles.css">

<!-- Carousel -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/lightslider/1.1.6/css/lightslider.css">

{{--chat part--}}
<link href="https://fonts.googleapis.com/css?family=Sansita" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">


text:
'use strict';

import {Type} from '../type';

export= new Type('tag:yaml.org,2002:map', {
  kind: 'mapping',
  construct: function (data) { return null !== data ? data : {}; }
});


text:
package com.feedzai.fos.server.remote.impl;

import com.feedzai.fos.api.*;
import com.feedzai.fos.common.validation.NotBlank;
import com.feedzai.fos.common.validation.NotNull;
import com.feedzai.fos.server.remote.api.IRemoteManager;
import com.google.common.base.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.rmi.RemoteException;
import java.util.List;
import java.util.Map;
import java.util.UUID;

/**
 * Remote manager that encapsulates an underlying @{Manager}.
 * <p/>
 * Encapsulates the underlying implementation exceptions in RemoteExceptions.
 *
 * @author Marco Jorge (marco.jorge@feedzai.com)
 */
public class RemoteManager implements IRemoteManager {
    private static final Logger logger = LoggerFactory.getLogger(RemoteManager.class);

    private Manager manager;
    private RemoteScorer remoteScorer;

    /**
     * Creates a new @{Manager} that delegates all calls to the underlying @{Manager}.
     *
     * @param manager the underlying manager
     * @throws Exception when retrieving the @{Scorer} from the underlying implementation
     */
    public RemoteManager(Manager manager) throws Exception {
        this.manager = manager;
        this.remoteScorer = new RemoteScorer(manager.getScorer());
    }

    @Override
    public UUID addModel(ModelConfig config, Model model) throws RemoteException, FOSException {
        return this.manager.addModel(config, model);
    }

    @Override
    public UUID addModel(ModelConfig config, @NotBlank ModelDescriptor descriptor) throws RemoteException, FOSException {
        return this.manager.addModel(config, descriptor);
    }

    @Override
    public void removeModel(UUID modelId) throws RemoteException, FOSException {
        this.manager.removeModel(modelId);
    }

    @Override
    public void reconfigureModel(UUID modelId, ModelConfig config) throws RemoteException, FOSException {
        this.manager.reconfigureModel(modelId, config);
    }

    @Override
    public void reconfigureModel(UUID modelId, ModelConfig config, Model model) throws RemoteException, FOSException {
        this.manager.reconfigureModel(modelId, config, model);
    }

    @Override
    public void reconfigureModel(UUID modelId, ModelConfig config, ModelDescriptor descriptor) throws RemoteException, FOSException {
        this.manager.reconfigureModel(modelId, config, descriptor);
    }

    @Override
    @NotNull
    public Map<UUID, ? extends ModelConfig> listModels() throws RemoteException, FOSException {
        return this.manager.listModels();

    }

    @Override
    @NotNull
    public RemoteScorer getScorer() throws RemoteException {
        return this.remoteScorer;
    }

    @Override
    public void close() throws RemoteException, FOSException {
        this.manager.close();

    }

    @Override
    public UUID trainAndAdd(ModelConfig config, List<Object[]> instances) throws RemoteException, FOSException {
        return this.manager.trainAndAdd(config, instances);

    }

    @Override
    public UUID trainAndAddFile(ModelConfig config, String path) throws RemoteException, FOSException {
        return this.manager.trainAndAddFile(config, path);
    }

    @Override
    public Model train(ModelConfig config, List<Object[]> instances) throws RemoteException, FOSException {
        return manager.train(config, instances);
    }

    @Override
    public double[] featureImportance(UUID uuid, Optional<List<Object[]>> instances, long seed) throws RemoteException, FOSException {
        return manager.featureImportance(uuid, instances, seed);
    }

    @Override
    public Model trainFile(ModelConfig config, String path) throws RemoteException, FOSException {
        return manager.trainFile(config, path);
    }

    @Override
    public void save(UUID uuid, String savepath) throws RemoteException, FOSException {
        this.manager.save(uuid, savepath);
    }

    @Override
    public void saveAsPMML(UUID uuid, String savePath, boolean compress) throws FOSException {
        this.manager.saveAsPMML(uuid, savePath, compress);
    }
}


text:
const webpack = require('atool-build/lib/webpack');
const fs = require('fs');
const path = require('path');
const glob = require('glob');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var OpenBrowserPlugin = require('open-browser-webpack-plugin'); //自动打开浏览器插件

var webpackShimConfig = {
    shim: {
        // absolute paths are also possible
        [path.join(__dirname, 'src/pipes/hexbin.js')]: {
            exports: 'd3.hexbin',
            deps: ['d3']
        },
        [path.join(__dirname, 'src/topo/ht.js')]: {
            exports: 'ht'
        },
        [path.join(__dirname, 'src/topo/ht-autolayout.js')]: {
            exports: 'ht'
        },
        [path.join(__dirname, 'src/topo/ht-flow.js')]: {
            deps: ['ht']
        },
        [path.join(__dirname, 'src/topo/ht-animation.js')]: {
            deps: ['ht']
        }
    }
};

module.exports = function (webpackConfig) {
    webpackConfig.babel.plugins.push('transform-runtime');
    webpackConfig.babel.plugins.push(['import', {
        libraryName: 'antd',
        style: 'css'
    }]);

    webpackConfig.plugins.splice(0, 1);
    webpackConfig.plugins.push(
        new webpack.optimize.DedupePlugin(),
        new webpack.optimize.CommonsChunkPlugin({
            name: ['app', 'vendor'],
            minChunks: Infinity
        }),
        new webpack.ProvidePlugin({
            $: 'jquery',
            jQuery: 'jquery',
            'window.jQuery': 'jquery',
            d3: 'd3'
        }),
        new HtmlWebpackPlugin({
            template: 'src/entries/app.html'
        }),
        new OpenBrowserPlugin({
            url: 'http://localhost:8989/outlink'
        })
    );

    webpackConfig.module.loaders.push(
        {
            test: require.resolve('jquery'),
            loader: 'expose?$'
        },
        {
            test: require.resolve('d3'),
            loader: 'expose?d3'
        }
    );

    webpackConfig.module.loaders.push(
        {
            test: /\\.entries\\app.js$/,
            loader: 'shim-loader',
            query: webpackShimConfig
        }
    );

    // Enable this if you have to support IE8.
    // webpackConfig.module.loaders.unshift({
    //   test: /\.jsx?$/,
    //   loader: 'es3ify-loader',
    // });

    // Parse all less files as css module.
    webpackConfig.module.loaders.forEach(function (loader, index) {
        if (typeof loader.test === 'function' && loader.test.toString().indexOf('\\.less$') > -1) {
            loader.test = /\.dont\.exist\.file/;
        }

        if (loader.test.toString() === '/\\.module\\.less$/') {
            loader.test = /\.less$/;
        }

        if (loader.test.toString() === '/\\.html?$/') {
            loader.loader = 'html';
        }

        if (loader.test.toString().indexOf('/\\.(png|jpg|jpeg|gif)') > -1) {
            loader.loader = 'url';
            loader.query = {
                limit: 8192,
                name: 'assets/imgs/[name].[ext]'
            };
        }
        if (loader.test.toString().indexOf('/\\.woff') > -1) {
            loader.loader = 'url';
            loader.query = {
                limit: 1000,
                minetype: 'application/font-woff',
                name: 'assets/fonts/[name].[ext]'
            };
        }
        if (loader.test.toString().indexOf('/\\.woff2') > -1) {
            loader.loader = 'url';
            loader.query = {
                limit: 1000,
                minetype: 'application/font-woff',
                name: 'assets/fonts/[name].[ext]'
            };
        }
        if (loader.test.toString().indexOf('/\\.ttf') > -1) {
            loader.loader = 'url';
            loader.query = {
                limit: 1000,
                minetype: 'application/octet-stream',
                name: 'assets/fonts/[name].[ext]'
            };
        }
        if (loader.test.toString().indexOf('/\\.eot') > -1) {
            loader.loader = 'file';
            loader.query = {
                limit: 1000,
                name: 'assets/fonts/[name].[ext]'
            };
        }
        if (loader.test.toString().indexOf('/\\.svg') > -1) {
            loader.loader = 'url';
            loader.query = {
                limit: 1000,
                minetype: 'image/svg+xml',
                name: 'assets/fonts/[name].[ext]'
            };
        }
    });

    // Load src/entries/*.js as entry automatically.
    const files = glob.sync('./src/entries/*.js');
    const newEntries = files.reduce(function (memo, file) {
        const name = path.basename(file, '.js');
        memo[name] = file;
        return memo;
    }, {});
    webpackConfig.entry = Object.assign({}, webpackConfig.entry, newEntries);

    webpackConfig.devtool = 'source-map';

    return webpackConfig;
};


text:
'use strict';

import React from 'react';
import PropTypes from 'prop-types';

var CubeMapPropType = require('./CubeMapPropType');
var ColorPropType = require('react-native/Libraries/DeprecatedPropTypes/DeprecatedColorPropType');

var MaterialPropTypes = {
  shininess: PropTypes.number,
  fresnelExponent: PropTypes.number,
  lightingModel: PropTypes.oneOf(['Phong', 'Blinn', 'Lambert', 'Constant', 'PBR']),
  writesToDepthBuffer: PropTypes.bool,
  readsFromDepthBuffer: PropTypes.bool,
  colorWriteMask: PropTypes.arrayOf(PropTypes.oneOf(['None', 'Red', 'Green', 'Blue', 'Alpha', 'All'])),
  cullMode: PropTypes.oneOf(['None', 'Back', 'Front']),
  blendMode: PropTypes.oneOf(['None', 'Alpha', 'Add', 'Subtract', 'Multiply', 'Screen']),
  diffuseTexture: PropTypes.any,
  diffuseIntensity: PropTypes.number,
  specularTexture: PropTypes.any,
  normalTexture: PropTypes.any,
  reflectiveTexture: CubeMapPropType,
  diffuseColor: ColorPropType,
  chromaKeyFilteringColor: ColorPropType,
  wrapS: PropTypes.oneOf(['Clamp', 'Repeat', 'Mirror']),
  wrapT: PropTypes.oneOf(['Clamp', 'Repeat', 'Mirror']),
  minificationFilter: PropTypes.oneOf(['Nearest', 'Linear']),
  magnificationFilter: PropTypes.oneOf(['Nearest', 'Linear']),
  mipFilter: PropTypes.oneOf(['Nearest', 'Linear']),
  bloomThreshold: PropTypes.number,
  roughness: PropTypes.number,
  roughnessTexture: PropTypes.any,
  metalness: PropTypes.number,
  metalnessTexture: PropTypes.any,
  ambientOcclusionTexture: PropTypes.any,
};

module.exports = MaterialPropTypes;