<commit_before>var templates = {

    selectedClusterNode : {

        selectedNodeInfoTemplate: [
            "
Selected node:
" +
                "Name: {{name}}",
            "ID: \"{{id}}\"",
            "Hostname: {{hostname}}"
        ].join("
"),

        selectedNodeHTTPTemplate: [
            "HTTP address: {{http_address}}",
            "",
            "Bound address: {{http.bound_address}}",
            "",
            "Publish address: {{http.publish_address}}"
        ].join("
"),

        selectedNodeTransportTemplate: [
            "Transport address: {{transport_address}}",
            "",
            "Bound address: {{transport.bound_address}}",
            "",
            "Publish address: {{transport.publish_address}}"
        ].join("
"),

        jvmHeapMem: [
            "
Committed: n/a
",
            "
Used: n/a
"
        ].join(""),

        jvmNonHeapMem: [
            "
Committed: n/a
",
            "
Used: n/a
"
        ].join(""),

        jvmThreads: [
            "
Peak: n/a
",
            "
Count: n/a
"
        ].join(""),

        jvmGC: [
            "
Total time: n/a
",
            "
Total count: n/a
"
        ].join(""),

        fileDescriptorsTemplate: [
            "
Max: {{process.max_file_descriptors}}
",
            "
Open: n/a
"
//        "
Refresh interval: {{process.refresh_interval}}ms
"
        ].join(""),

        process_MemTemplate: [
            "
Total virtual: n/a
",
            "
Resident: n/a
",
            "
Share: n/a
"
        ].join(""),

        process_CPU_timeTemplate: [
            "
Sys total: n/a
",
            "
User total: n/a
"
        ].join(""),

        process_CPU_pctTemplate: [
            "
Total: n/a
",
            "
Process: n/a
"
        ].join(""),

        osCpu: [
            "
Total: 100%
",
            "
User: n/a
",
            "
Sys: n/a
"
        ].join(""),

        osMem: [
            "
Free: n/a
",
            "
Used: n/a
"
        ].join(""),

        osSwap: [
            "
Free: n/a
",
            "
Used: n/a
"
        ].join(""),

        osLoad: [
            "
2: n/a
",
            "
1: n/a
",
            "
0: n/a
"
        ].join(""),

        channelsTemplate: [
            "
Transport: na
",
            "
HTTP: na
",
            "
HTTP total opened: na
"
        ].join(""),

        TDBTemplate: [
            "<svg width='100%' height='90'>" +
                "<rect x='0' y='0' width='100%' height='100%' fill='#eee' stroke-width='1' />" +
                "</svg>"
        ].join(""),

        jvmInfoTemplate1: [
            "VM name: {{vm_name}}",
            "VM vendor: {{vm_vendor}}",
            "VM version: {{vm_version}}"
        ].join("
"),

        jvmInfoTemplate2: [
            "Uptime: n/a",
            "Java version: {{version}}",
            "PID: {{pid}}"
        ].join("
"),

        osInfoTemplate1: [
            "CPU vendor: {{cpu.vendor}}",
            "CPU model: {{cpu.model}} ({{cpu.mhz}} MHz)",
            "CPU total cores: {{cpu.total_cores}}",
            "CPU sockets: {{cpu.total_sockets}} with {{cpu.cores_per_socket}} cores each",
            "CPU cache: {{cpu.cache_size}}"
        ].join("
"),

        osInfoTemplate2: [
            "Uptime: n/a",
            "Refresh interval: {{refresh_interval}}ms",
            "Total mem: {{mem.total}} ({{mem.total_in_bytes}} b)",
            "Total swap: {{swap.total}} ({{swap.total_in_bytes}} b)"
        ].join("
"),

        indices1Template: [
            "Size: n/a",
            "Docs count: n/a",
            "Docs deleted: n/a",
            "Flush: n/a",
            "Refresh: n/a"
        ].join("
"),

        fsDataInfoTemplate: [
            "
Device: {{dev}}
",
            "
Mount: {{mount}}
",
            "
Path: {{path}}
",
            "
Free: {{free}}
",
            "
Available: {{available}}
",
            "
Total: {{total}}
"
        ].join(""),

        fsDataInfo_cntTemplate: [
            "
Writes: n/a
",
            "
Reads: n/a
"
        ].join(""),

        fsDataInfo_sizeTemplate: [
            "
Write: n/a
",
            "
Read: n/a
"
        ].join("")

    }

};
<commit_msg>comment out cores_per_socket (seems like the value returned by sigar is incorrect?)<commit_after>var templates = {

    selectedClusterNode : {

        selectedNodeInfoTemplate: [
            "
Selected node:
" +
                "Name: {{name}}",
            "ID: \"{{id}}\"",
            "Hostname: {{hostname}}"
        ].join("
"),

        selectedNodeHTTPTemplate: [
            "HTTP address: {{http_address}}",
            "",
            "Bound address: {{http.bound_address}}",
            "",
            "Publish address: {{http.publish_address}}"
        ].join("
"),

        selectedNodeTransportTemplate: [
            "Transport address: {{transport_address}}",
            "",
            "Bound address: {{transport.bound_address}}",
            "",
            "Publish address: {{transport.publish_address}}"
        ].join("
"),

        jvmHeapMem: [
            "
Committed: n/a
",
            "
Used: n/a
"
        ].join(""),

        jvmNonHeapMem: [
            "
Committed: n/a
",
            "
Used: n/a
"
        ].join(""),

        jvmThreads: [
            "
Peak: n/a
",
            "
Count: n/a
"
        ].join(""),

        jvmGC: [
            "
Total time: n/a
",
            "
Total count: n/a
"
        ].join(""),

        fileDescriptorsTemplate: [
            "
Max: {{process.max_file_descriptors}}
",
            "
Open: n/a
"
//        "
Refresh interval: {{process.refresh_interval}}ms
"
        ].join(""),

        process_MemTemplate: [
            "
Total virtual: n/a
",
            "
Resident: n/a
",
            "
Share: n/a
"
        ].join(""),

        process_CPU_timeTemplate: [
            "
Sys total: n/a
",
            "
User total: n/a
"
        ].join(""),

        process_CPU_pctTemplate: [
            "
Total: n/a
",
            "
Process: n/a
"
        ].join(""),

        osCpu: [
            "
Total: 100%
",
            "
User: n/a
",
            "
Sys: n/a
"
        ].join(""),

        osMem: [
            "
Free: n/a
",
            "
Used: n/a
"
        ].join(""),

        osSwap: [
            "
Free: n/a
",
            "
Used: n/a
"
        ].join(""),

        osLoad: [
            "
2: n/a
",
            "
1: n/a
",
            "
0: n/a
"
        ].join(""),

        channelsTemplate: [
            "
Transport: na
",
            "
HTTP: na
",
            "
HTTP total opened: na
"
        ].join(""),

        TDBTemplate: [
            "<svg width='100%' height='90'>" +
                "<rect x='0' y='0' width='100%' height='100%' fill='#eee' stroke-width='1' />" +
                "</svg>"
        ].join(""),

        jvmInfoTemplate1: [
            "VM name: {{vm_name}}",
            "VM vendor: {{vm_vendor}}",
            "VM version: {{vm_version}}"
        ].join("
"),

        jvmInfoTemplate2: [
            "Uptime: n/a",
            "Java version: {{version}}",
            "PID: {{pid}}"
        ].join("
"),

        osInfoTemplate1: [
            "CPU vendor: {{cpu.vendor}}",
            "CPU model: {{cpu.model}} ({{cpu.mhz}} MHz)",
            "CPU total logical cores: {{cpu.total_cores}}",
//            "CPU sockets: {{cpu.total_sockets}} with {{cpu.cores_per_socket}} cores each", // seems like there is a sigar bug?
            "CPU cache: {{cpu.cache_size}}"
        ].join("
"),

        osInfoTemplate2: [
            "Uptime: n/a",
            "Refresh interval: {{refresh_interval}}ms",
            "Total mem: {{mem.total}} ({{mem.total_in_bytes}} b)",
            "Total swap: {{swap.total}} ({{swap.total_in_bytes}} b)"
        ].join("
"),

        indices1Template: [
            "Size: n/a",
            "Docs count: n/a",
            "Docs deleted: n/a",
            "Flush: n/a",
            "Refresh: n/a"
        ].join("
"),

        fsDataInfoTemplate: [
            "
Device: {{dev}}
",
            "
Mount: {{mount}}
",
            "
Path: {{path}}
",
            "
Free: {{free}}
",
            "
Available: {{available}}
",
            "
Total: {{total}}
"
        ].join(""),

        fsDataInfo_cntTemplate: [
            "
Writes: n/a
",
            "
Reads: n/a
"
        ].join(""),

        fsDataInfo_sizeTemplate: [
            "
Write: n/a
",
            "
Read: n/a
"
        ].join("")

    }

};
<|endoftext|>


<commit_before>/* Typewriter text animation */

document.addEventListener("DOMContentLoaded", () => {
  window.typewriter = {
    element: document.getElementById("typewriter"),
    contents: [
      "I write codez.\xa0",
      "I write software.\xa0",
      "I write websites.\xa0",
      "I write apps.\xa0",
      "I write libraries.\xa0",
      "I write simulations.\xa0",
      "I design experiences.\xa0",
      "I design interfaces.\xa0"
    ],
    contentIndex: 0,

    // A random delay in ms will be chosen from this range. The resulting delay
    // is multiplied for typing, so this isn't exact.
    typingDelay: [50, 100],

    /* Find common words that two strings start with. */
    _commonStart: (a, b) => {
      const aWords = a.split(" ");
      const bWords = b.split(" ");

      const commonWords = [];
      for (const i of aWords) {
        if (aWords[i] === bWords[i]) {
          commonWords.push(aWords[i]);
        } else {
          return commonWords.join(" ");
        }
      }
    },

    /* Get instructions for transforming between two strings in the form of
     * number of characters to delete and characters to add.
     */
    _transitionDescription: (a, b) => {
      const common = this._commonStart(a, b);
      const numCharactersToDelete = a.length - common.length;
      const charactersToAdd = b.slice(common.length);
      return {
        del: numCharactersToDelete,
        add: charactersToAdd
      };
    },

    _getTypingDelay: () => {
      return Math.floor((Math.random() * (this.typingDelay[1] - this.typingDelay[0])) + this.typingDelay[0]);
    },

    /* Animate bacspacing by a given number of characters */
    backspace: (num, callback) => {
      let content;
      let toGo = num;
      callback = callback || (() => {});
      this._backspace1 = () => {
        if (toGo === 0) {
          callback();
        } else {
          content = this.element.textContent;
          this.element.textContent = content.slice(0, content.length - 1);
          toGo--;
          setTimeout(() => window.typewriter._backspace1(), this._getTypingDelay());
        }
      };
      this._backspace1();
    },

    /* Animate inserting a given string at the end of the text */
    type: (text, callback) => {
      let i = 0;
      callback = callback || (() => {});
      this._type1 = () => {
        if (i === text.length) {
          callback();
        } else {
          this.element.textContent += text[i];
          i++;
          setTimeout(() => window.typewriter._type1(), this._getTypingDelay() * 1.5);
        }
      };
      this._type1();
    },

    /* Animate advancing to the next phrase */
    next: callback => {
      this.contentIndex++;
      // Loop back
      if (this.contentIndex === this.contents.length) {
        this.contentIndex = 0;
      }
      // Make changes
      const changesNeeded = this._transitionDescription(
        this.element.textContent,
        this.contents[this.contentIndex]
      );
      this.backspace(changesNeeded.del, () => {
        setTimeout(() => window.typewriter.type(changesNeeded.add, callback), 200);
      });
    },

    /* Fill the element with the first phrase (non-animated) and set up other
     * miscellaneous details.
     */
    init: () => {
      this.element.textContent = this.contents[0];
      this._startOnScroll = () => {
        if (
          window.scrollY + window.innerHeight > this.element.offsetTop + (this.element.offsetHeight / 2)
        ) {
          setTimeout(() => window.typewriter.play(), 1000);
          window.removeEventListener("scroll", scrollFunc);
        }
      };
      function scrollFunc() {
        window.typewriter._startOnScroll();
      }
      window.addEventListener("scroll", scrollFunc);
    },

    /* Recursively continue advancing */
    play: () => {
      this.next(() => {
        setTimeout(() => window.typewriter.play(), 3000);
      });
    }

  };

  window.typewriter.init();
});
<commit_msg>Use ES6 method syntax to fix errors in typewriter<commit_after>/* Typewriter text animation */

document.addEventListener("DOMContentLoaded", () => {
  window.typewriter = {
    element: document.getElementById("typewriter"),
    contents: [
      "I write code.\xa0",
      "I write software.\xa0",
      "I write websites.\xa0",
      "I write apps.\xa0",
      "I write libraries.\xa0",
      "I write simulations.\xa0",
      "I design experiences.\xa0",
      "I design interfaces.\xa0"
    ],
    contentIndex: 0,

    // A random delay in ms will be chosen from this range. The resulting delay
    // is multiplied for typing, so this isn't exact.
    typingDelay: [50, 100],

    /* Find common words that two strings start with. */
    _commonStart(a, b) {
      const aWords = a.split(" ");
      const bWords = b.split(" ");

      const commonWords = [];
      for (let i = 0; i < aWords.length; a++) {
        if (aWords[i] === bWords[i]) {
          commonWords.push(aWords[i]);
        } else {
          return commonWords.join(" ");
        }
      }
    },

    /* Get instructions for transforming between two strings in the form of
     * number of characters to delete and characters to add.
     */
    _transitionDescription(a, b) {
      const common = this._commonStart(a, b);
      const numCharactersToDelete = a.length - common.length;
      const charactersToAdd = b.slice(common.length);
      return {
        del: numCharactersToDelete,
        add: charactersToAdd
      };
    },

    _getTypingDelay() {
      return Math.floor((Math.random() * (this.typingDelay[1] - this.typingDelay[0])) + this.typingDelay[0]);
    },

    /* Animate bacspacing by a given number of characters */
    backspace(num, callback) {
      let content;
      let toGo = num;
      callback = callback || (() => {});
      this._backspace1 = () => {
        if (toGo === 0) {
          callback();
        } else {
          content = this.element.textContent;
          this.element.textContent = content.slice(0, content.length - 1);
          toGo--;
          setTimeout(() => window.typewriter._backspace1(), this._getTypingDelay());
        }
      };
      this._backspace1();
    },

    /* Animate inserting a given string at the end of the text */
    type(text, callback) {
      let i = 0;
      callback = callback || (() => {});
      this._type1 = () => {
        if (i === text.length) {
          callback();
        } else {
          this.element.textContent += text[i];
          i++;
          setTimeout(() => window.typewriter._type1(), this._getTypingDelay() * 1.5);
        }
      };
      this._type1();
    },

    /* Animate advancing to the next phrase */
    next(callback) {
      this.contentIndex++;
      // Loop back
      if (this.contentIndex === this.contents.length) {
        this.contentIndex = 0;
      }
      // Make changes
      const changesNeeded = this._transitionDescription(
        this.element.textContent,
        this.contents[this.contentIndex]
      );
      this.backspace(changesNeeded.del, () => {
        setTimeout(() => window.typewriter.type(changesNeeded.add, callback), 200);
      });
    },

    /* Fill the element with the first phrase (non-animated) and set up other
     * miscellaneous details.
     */
    init() {
      this.element.textContent = this.contents[0];
      this._startOnScroll = () => {
        if (
          window.scrollY + window.innerHeight > this.element.offsetTop + (this.element.offsetHeight / 2)
        ) {
          setTimeout(() => window.typewriter.play(), 1000);
          window.removeEventListener("scroll", scrollFunc);
        }
      };
      function scrollFunc() {
        window.typewriter._startOnScroll();
      }
      window.addEventListener("scroll", scrollFunc);
    },

    /* Recursively continue advancing */
    play() {
      this.next(() => {
        setTimeout(() => window.typewriter.play(), 3000);
      });
    }

  };

  window.typewriter.init();
});
<|endoftext|>


<commit_before>define([
  'views/base/view',
  'text!templates/user.hbs',
  'lib/three'
], function(View, template, THREE) {
  'use strict';

  var UserView = View.extend({
    // Automatically render after initialize
    autoRender: true,

    className: 'user-view',

    // Save the template string in a prototype property.
    // This is overwritten with the compiled template function.
    // In the end you might want to used precompiled templates.
    template: template,

    makeCube: function() {

      console.log('view:');
      console.log(View);
      console.log('template:');
      console.log(template);
      console.log('three:');
      console.log(THREE);

      var scene = new THREE.Scene();
      var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );

      var renderer = new THREE.WebGLRenderer();
      renderer.setSize( window.innerWidth, window.innerHeight );
      document.body.appendChild( renderer.domElement );

      var geometry = new THREE.BoxGeometry( 1, 1, 1 );
      var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
      var cube = new THREE.Mesh( geometry, material );
      scene.add( cube );

      camera.position.z = 5;

      var render = function () {
        requestAnimationFrame( render );

        cube.rotation.x += 0.1;
        cube.rotation.y += 0.1;

        renderer.render(scene, camera);
      };

      render();
    }
  });

  return UserView;
});
<commit_msg>javascript requires<commit_after>define([
  'views/base/view',
  'text!templates/user.hbs',
  'lib/three',
  'lib/utils'
], function(View, template, Three, Utils) {
  'use strict';

  var UserView = View.extend({
    // Automatically render after initialize
    autoRender: true,

    className: 'user-view',

    // Save the template string in a prototype property.
    // This is overwritten with the compiled template function.
    // In the end you might want to used precompiled templates.
    template: template,

    makeCube: function() {

      console.log('view:');
      console.log(View);
      console.log('template:');
      console.log(template);
      console.log('three:');
      console.log(Three);
      console.log('utils:');
      console.log(Utils);

      // var scene = new THREE.Scene();
      // var camera = new THREE.PerspectiveCamera( 75, window.innerWidth/window.innerHeight, 0.1, 1000 );

      // var renderer = new THREE.WebGLRenderer();
      // renderer.setSize( window.innerWidth, window.innerHeight );
      // document.body.appendChild( renderer.domElement );

      // var geometry = new THREE.BoxGeometry( 1, 1, 1 );
      // var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
      // var cube = new THREE.Mesh( geometry, material );
      // scene.add( cube );

      // camera.position.z = 5;

      // var render = function () {
      //   requestAnimationFrame( render );

      //   cube.rotation.x += 0.1;
      //   cube.rotation.y += 0.1;

      //   renderer.render(scene, camera);
      // };

      // render();
    }
  });

  return UserView;
});
<|endoftext|>


<commit_before>

//api
var JSActiveModel = function(){
};

JSActiveModel.scopeFunction = function( func, scope ){
  return function() {
    return func.apply(scope, arguments);
  };
}

JSActiveModel.scopeFunctions = function( target, source, scope ){
  for(var i in source){
    target[i] = JSActiveModel.scopeFunction( source[i], scope );
  }
}

JSActiveModel.inheritKlass = function(k1, k2){
  k1.klass = k1["klass"] || {};
  for (var p in k2.klass) {
    k1.klass[p] = k2.klass[p];
  }
  k1.parent = k1['parent'] || {};
  JSActiveModel.scopeFunctions( k1.parent, k2.klass, k1 );
}

JSActiveModel.hideKlass = function(model){
  if (model['klass']) JSActiveModel.scopeFunctions( model, model.klass, model );
}

JSActiveModel.parms = {
  foo : 'bar',
  baz : 'boo'
}

JSActiveModel.prototype = {
  update : function(){
  },
  create : function(){
  },
  destroy : function(){
  }
}

JSActiveModel.klass = {
  all : function(){
  },
  where : function(){
  },
  find : function(){
    $.getJSON(url + '?auth_token=' + AUTH_TOKEN +'&callback=?', returnHandler);
  },
  find_by_sql : function(){
  }
};

JSActiveModel.hideKlass(JSActiveModel);

//local database
var JSActiveModelSync = function(){
};

JSActiveModelSync.prototype = new JSActiveModel();
JSActiveModelSync.prototype.constructor = JSActiveModelSync;
JSActiveModelSync.prototype.parent = JSActiveModel.prototype;

JSActiveModel.inheritKlass(JSActiveModelSync, JSActiveModel);

JSActiveModelSync.parms = {
}

//proto methods
JSActiveModelSync.prototype.dbopen = function(){
  //these vars should have been set on some global var
  //var DATABASE = '';
  //var DBVERSION = '';
  //var DBDESCRIPTION = '';
  //var DBSIZE = '';
  if(window.openDatabase){
    db = openDatabase(DATABASE, DBVERSION, DBDESCRIPTION, DBSIZE);
    return true;
  }else{
    return false;
  }
}
JSActiveModelSync.prototype.dbsetup = function(DBTABLE, DBCOLUMNS){
  if(methods.db_open()){
    DBCOLUMNS = DBCOLUMNS + ', local_storage_id';
    db.transaction(function (tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS ' + DBTABLE + ' (' + DBCOLUMNS + ')');
      tx.executeSql('CREATE TABLE IF NOT EXISTS ' + DBTABLE + '_AUDIT (' + DBCOLUMNS + ', api_url)');
    });
  }else{
    //methods.get_records( url );
  }
}
JSActiveModelSync.prototype.update = function(){
  console.log('PARMS: ', this.parms);
}
JSActiveModelSync.prototype.create = function(){
}
JSActiveModelSync.prototype.destroy = function(){
}

//klass methods
JSActiveModelSync.klass = {
  all : function(){
  },
  find : function(){
          var DBTABLE = $(this)[0].DBTABLE;
          //get results localy
          db.transaction(function (tx) {
            tx.executeSql('SELECT * FROM '+ DBTABLE +' WHERE local_storage_id = ?', [id], function (tx, results) {
              data = [];
              var len = results.rows.length, i;
              for (i = 0; i < len; i++) {
                data.push({DBTABLE:{'name': results.rows.item(i).name}});
                //alert(results.rows.item(i).name);
              }
              findHandle(data);
            });
          });
  },
  where : function(){
  },
  find_by_sql : function(){
  }
}

JSActiveModel.hideKlass(JSActiveModelSync);

//app model
var Jet = function(){};
Jet.parms = {
  DBTABLE: 'jet',
  DBCOLUMNS: []
};
Jet.prototype = new JSActiveModelSync();
Jet.prototype.constructor = Jet;
Jet.prototype.parent = JSActiveModelSync.prototype;

JSActiveModel.inheritKlass(Jet, JSActiveModelSync);
JSActiveModel.hideKlass(Jet);

jet = new JSActiveModelSync;
jet.create('foo');

Jet.all;
<commit_msg>push to netbook<commit_after>

//api
var JSActiveModel = function(){
};

JSActiveModel.scopeFunction = function( func, scope ){
  return function() {
    return func.apply(scope, arguments);
  };
}

JSActiveModel.scopeFunctions = function( target, source, scope ){
  for(var i in source){
    target[i] = JSActiveModel.scopeFunction( source[i], scope );
  }
}

JSActiveModel.inheritKlass = function(k1, k2){
  k1.klass = k1["klass"] || {};
  for (var p in k2.klass) {
    k1.klass[p] = k2.klass[p];
  }
  k1.parent = k1['parent'] || {};
  JSActiveModel.scopeFunctions( k1.parent, k2.klass, k1 );
}

JSActiveModel.hideKlass = function(model){
  if (model['klass']) JSActiveModel.scopeFunctions( model, model.klass, model );
}

JSActiveModel.parms = {
  foo : 'bar',
  baz : 'boo'
}

JSActiveModel.prototype = {
  update : function(){
  },
  create : function(){
  },
  destroy : function(){
  }
}

JSActiveModel.klass = {
  all : function(){
  },
  where : function(){
  },
  find : function(){
    $.getJSON(url + '?auth_token=' + AUTH_TOKEN +'&callback=?', returnHandler);
  },
  find_by_sql : function(){
  }
};

JSActiveModel.hideKlass(JSActiveModel);

//local database
var JSActiveModelSync = function(){
};

JSActiveModelSync.prototype = new JSActiveModel();
JSActiveModelSync.prototype.constructor = JSActiveModelSync;
JSActiveModelSync.prototype.parent = JSActiveModel.prototype;

JSActiveModel.inheritKlass(JSActiveModelSync, JSActiveModel);

JSActiveModelSync.parms = {
}

//proto methods
JSActiveModelSync.prototype.init = function(parms){
  console.log('second: init');
  JSActiveModelSync.prototype.dbsetup(parms);
}
JSActiveModelSync.prototype.dbopen = function(parms){
  console.log('fourth: dbopen');
  //these vars should have been set on some global var
  if(window.openDatabase){
    var DATABASE = parms['DATABASE'];
    var DBVERSION = parms['DBVERSION'];
    var DBDESCRIPTION = parms['DBDESCRIPTION'];
    var DBSIZE = parms['DBSIZE'];
    db = openDatabase(DATABASE, DBVERSION, DBDESCRIPTION, DBSIZE);
    return true;
  }else{
    return false;
  }
}
JSActiveModelSync.prototype.dbsetup = function(parms){
  console.log('third: dbsetup');
  if(JSActiveModelSync.prototype.dbopen(parms)){
    console.log('here');
    var DBTABLE = parms['DBTABLE'];
    var DBCOLUMNS = parms['DBCOLUMNS'];
    DBCOLUMNS = DBCOLUMNS + ', local_storage_id';
    db.transaction(function (tx) {
      tx.executeSql('CREATE TABLE IF NOT EXISTS ' + DBTABLE + ' (' + DBCOLUMNS + ')');
      tx.executeSql('CREATE TABLE IF NOT EXISTS ' + DBTABLE + '_AUDIT (' + DBCOLUMNS + ', api_url)');
    });
  }else{
    //methods.get_records( url );
  }
}
JSActiveModelSync.prototype.update = function(){
  console.log('PARMS: ', this.parms);
}
JSActiveModelSync.prototype.create = function(){
}
JSActiveModelSync.prototype.destroy = function(){
}

//klass methods
JSActiveModelSync.klass = {
  all : function(){
    console.log('first: all');
    JSActiveModelSync.prototype.init(this.parms); //make sure db is available
    DBTABLE = this.parms['DBTABLE'];
    db.transaction(function (tx) {
      console.log(DBTABLE);
      tx.executeSql('SELECT * FROM ' + DBTABLE, function (tx, results) {
        console.log('here i am');
        data = [];
        var len = results.rows.length, i;
        for (i = 0; i < len; i++) {
          //data.push({DBTABLE:{'name': results.rows.item(i).name}});
        }
        //allHandle(data);
      });
    });
  },
  find : function(){
          //get results localy
          db.transaction(function (tx) {
            tx.executeSql('SELECT * FROM '+ DBTABLE +' WHERE local_storage_id = ?', [id], function (tx, results) {
              data = [];
              var len = results.rows.length, i;
              for (i = 0; i < len; i++) {
                data.push({DBTABLE:{'name': results.rows.item(i).name}});
                //alert(results.rows.item(i).name);
              }
              findHandle(data);
            });
          });
  },
  where : function(){
  },
  find_by_sql : function(){
  }
}

JSActiveModel.hideKlass(JSActiveModelSync);

//app model
var Jet = function(){};
Jet.parms = {
  DATABASE: 'teakapp',
  DBVERSION: '1',
  DBDESCRIPTION: 'testing',
  DBSIZE: 2 * 1024 * 1024,
  DBTABLE: 'b',
  DBCOLUMNS: ['id', 'name', 'email', 'address', 'city', 'state', 'zip', 'country', 'phone', 'fax', 'other_info', 'a_id', 'flag_archive', 'created_at', 'updated_at']
};
Jet.prototype = new JSActiveModelSync();
Jet.prototype.constructor = Jet;
Jet.prototype.parent = JSActiveModelSync.prototype;

JSActiveModel.inheritKlass(Jet, JSActiveModelSync);
JSActiveModel.hideKlass(Jet);

jet = new JSActiveModelSync;
jet.create('foo');

Jet.all();
<|endoftext|>


<commit_before>/**
 * Use this jQuery plugin to auto-save and restore form data via
 * jStorage to protect against browser crashes and other accidental
 * interruptions.
 *
 * Usage:
 *
 * 1. Include the script and prerequisites:
 *
 *
 *
 *
 *
 *
 * 2. Initialize the form:
 *
 *
 *
 * 3. Add a restore option if the saved data is detected on page load
 * (using an Elefant template as an example):
 *
 *
Auto-saved data found for this form. Click here to restore.

 *
 * 4. Add class="autosave-clear" to the submit button so saving the form
 * clears the data.
 *
 * 5. To add a cancel link, add the following onclick handler:
 *
 *   onclick="return $.cancel_autosave ('Are you sure you want to cancel?')"
 *
 * The stored key name is determined as follows:
 *
 *   "autosave-" + (pathname + parameters).replace (/[^a-z0-9-]/g, '')
 *
 * So for example if the request is:
 *
 *   /admin/edit?page=index
 *
 * The key name will be:
 *
 *   autosave-admineditpageindex
 *
 */
var autosave_interval = null,
	autosave_focused = false,
	autosave_key_name = 'autosave-' + (window.location.pathname + window.location.search).replace (/[^a-zA-Z0-9-]+/g, '');

(function ($) {
	if ($.jStorage.get (autosave_key_name)) {
		setTimeout (function () {
			var vals = $.parseJSON (lzw_decode ($.jStorage.get (autosave_key_name)));
			$('.autosave-notice').show ();
		}, 100);
	}

	$.cancel_autosave = function (msg) {
		if (confirm (msg)) {
			$.jStorage.deleteKey (autosave_key_name);
			return true;
		}
		return false;
	}

	$.fn.extend ({
		autosave: function (options) {
			var defaults = {
				interval: 10000,
				form: null,
			};

			var options = $.extend (defaults, options);

			// Get the form object
			options.form = this[0];

			// Handler to clear the key (used on submit)
			$('.autosave-clear').click (function () {
				$.jStorage.deleteKey (autosave_key_name);
			});

			// Handler to restore data from the key
			$('.autosave-restore').click (function () {
				var i = 0,
					opts = options,
					vals = $.parseJSON (lzw_decode ($.jStorage.get (autosave_key_name)));

				for (i = 0; i < vals.length; i++) {
					try {
						// Set the field value
						if ($(opts.form.elements[vals[i].name]).is (':radio') || $(opts.form.elements[vals[i].name]).is (':checkbox')) {
							if (vals[i].value) {
								$(opts.form.elements[vals[i].name]).attr ('checked', 'checked');
							} else {
								$(opts.form.elements[vals[i].name]).attr ('checked', null);
							}
						} else {
							opts.form.elements[vals[i].name].value = vals[i].value;
						}

						if (opts.form.elements[vals[i].name].getAttribute ('id') == 'webpage-body') {
							// Set the contents of wysiwyg editor
							$('#webpage-body').redactor ('set', vals[i].value);
						} else if (opts.form.elements[vals[i].name].getAttribute ('id') == 'code-body') {
							// Set the contents of codemirror editor
							_codemirror.setValue (vals[i].value);
						} else if ($(opts.form.elements[vals[i].name]).data ('codemirror')) {
							// Set the contents of codemirror editor
							$.codemirror[opts.form.elements[vals[i].name].getAttribute ('id')].setValue (vals[i].value);
						} else if (opts.form.elements[vals[i].name].getAttribute ('id') == 'tags') {
							// Set the contents of tag-it widget
							$('#tagit').tagit ('removeAll');
							var tags = vals[i].value.split (',');
							for (var t = 0; t < tags.length; t++) {
								$('#tagit').tagit ('createTag', tags[t]);
							}
						}
					} catch (e) {}
				}

				// Clear the key
				$.jStorage.deleteKey (autosave_key_name);

				// Hide the restore notice
				$('.autosave-notice').slideUp ('slow');
				return false;
			});

			// Add a focus handler that triggers saving only once the form is active
			for (var i = 0; i < options.form.elements.length; i++) {
				$(options.form.elements[i]).focus (function () {
					autosave_focused = true;
				});
			}

			// Don't set the interval more than once
			if (autosave_interval != null) {
				return;
			}

			// Set an interval to save the form data
			autosave_interval = setInterval (function () {
				if (autosave_focused === false) {
					return;
				}

				var i = 0,
					opts = options,
					vals = [];

				for (i = 0; i < opts.form.elements.length; i++) {
					if (! opts.form.elements[i].name) {
						// Unnamed fields can be ignored (submit buttons)
						continue;
					}
					if (opts.form.elements[i].getAttribute ('id') == 'webpage-body') {
						// Get the contents from Redactor editor
						try {
							vals[i] = {
								name: opts.form.elements[i].name,
								value: $('#webpage-body').redactor ('get')
							};
						} catch (e) {}
					} else if (opts.form.elements[i].getAttribute ('id') == 'code-body') {
						// Get the contents from codemirror editor
						vals[i] = {
							name: opts.form.elements[i].name,
							value: _codemirror.getValue ()
						};
					} else if ($(opts.form.elements[i]).data ('codemirror')) {
						// Get the contents from codemirror editor
						vals[i] = {
							name: opts.form.elements[i].name,
							value: $.codemirror[opts.form.elements[i].getAttribute ('id')].getValue ()
						};
					} else if ($(opts.form.elements[i]).is (':radio') || $(opts.form.elements[i]).is (':checkbox')) {
						if (opts.form.elements[i].checked) {
							vals[i] = {
								name: opts.form.elements[i].name,
								value: true
							};
						} else {
							vals[i] = {
								name: opts.form.elements[i].name,
								value: false
							};
						}
					} else {
						// Get the contents from the field itself
						vals[i] = {
							name: opts.form.elements[i].name,
							value: opts.form.elements[i].value
						};
					}
				}

				var _json = JSON.stringify (vals);
				$.jStorage.set (autosave_key_name, lzw_encode (_json));
			}, options.interval);
		}
	});
})(jQuery);

// The following are from http://jsolait.net/

// LZW-compress a string
function lzw_encode(s) {
    var dict = {};
    var data = (s + "").split("");
    var out = [];
    var currChar;
    var phrase = data[0];
    var code = 256;
    for (var i=1; i<data.length; i++) {
        currChar=data[i];
        if (dict[phrase + currChar] != null) {
            phrase += currChar;
        }
        else {
            out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0));
            dict[phrase + currChar] = code;
            code++;
            phrase=currChar;
        }
    }
    out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0));
    for (var i=0; i<out.length; i++) {
        out[i] = String.fromCharCode(out[i]);
    }
    return out.join("");
}

// Decompress an LZW-encoded string
function lzw_decode(s) {
    var dict = {};
    var data = (s + "").split("");
    var currChar = data[0];
    var oldPhrase = currChar;
    var out = [currChar];
    var code = 256;
    var phrase;
    for (var i=1; i<data.length; i++) {
        var currCode = data[i].charCodeAt(0);
        if (currCode < 256) {
            phrase = data[i];
        }
        else {
           phrase = dict[currCode] ? dict[currCode] : (oldPhrase + currChar);
        }
        out.push(phrase);
        currChar = phrase.charAt(0);
        dict[code] = oldPhrase + currChar;
        code++;
        oldPhrase = phrase;
    }
    return out.join("");
}
<commit_msg>Updated jQuery.autosave for Redactor 10 upgrades<commit_after>/**
 * Use this jQuery plugin to auto-save and restore form data via
 * jStorage to protect against browser crashes and other accidental
 * interruptions.
 *
 * Usage:
 *
 * 1. Include the script and prerequisites:
 *
 *
 *
 *
 *
 *
 * 2. Initialize the form:
 *
 *
 *
 * 3. Add a restore option if the saved data is detected on page load
 * (using an Elefant template as an example):
 *
 *
Auto-saved data found for this form. Click here to restore.

 *
 * 4. Add class="autosave-clear" to the submit button so saving the form
 * clears the data.
 *
 * 5. To add a cancel link, add the following onclick handler:
 *
 *   onclick="return $.cancel_autosave ('Are you sure you want to cancel?')"
 *
 * The stored key name is determined as follows:
 *
 *   "autosave-" + (pathname + parameters).replace (/[^a-z0-9-]/g, '')
 *
 * So for example if the request is:
 *
 *   /admin/edit?page=index
 *
 * The key name will be:
 *
 *   autosave-admineditpageindex
 *
 */
var autosave_interval = null,
	autosave_focused = false,
	autosave_key_name = 'autosave-' + (window.location.pathname + window.location.search).replace (/[^a-zA-Z0-9-]+/g, '');

(function ($) {
	if ($.jStorage.get (autosave_key_name)) {
		setTimeout (function () {
			var vals = $.parseJSON (lzw_decode ($.jStorage.get (autosave_key_name)));
			$('.autosave-notice').show ();
		}, 100);
	}

	$.cancel_autosave = function (msg) {
		if (confirm (msg)) {
			$.jStorage.deleteKey (autosave_key_name);
			return true;
		}
		return false;
	}

	$.fn.extend ({
		autosave: function (options) {
			var defaults = {
				interval: 10000,
				form: null,
			};

			var options = $.extend (defaults, options);

			// Get the form object
			options.form = this[0];

			// Handler to clear the key (used on submit)
			$('.autosave-clear').click (function () {
				$.jStorage.deleteKey (autosave_key_name);
			});

			// Handler to restore data from the key
			$('.autosave-restore').click (function () {
				var i = 0,
					opts = options,
					vals = $.parseJSON (lzw_decode ($.jStorage.get (autosave_key_name)));

				for (i = 0; i < vals.length; i++) {
					try {
						// Set the field value
						if ($(opts.form.elements[vals[i].name]).is (':radio') || $(opts.form.elements[vals[i].name]).is (':checkbox')) {
							if (vals[i].value) {
								$(opts.form.elements[vals[i].name]).attr ('checked', 'checked');
							} else {
								$(opts.form.elements[vals[i].name]).attr ('checked', null);
							}
						} else {
							opts.form.elements[vals[i].name].value = vals[i].value;
						}

						if (opts.form.elements[vals[i].name].getAttribute ('data-wysiwyg') == 1) {
							// Set the contents of wysiwyg editor
							var id = opts.form.elements[vals[i].name].getAttribute ('id');
							$('#' + id).redactor ('code.set', vals[i].value);
						} else if (opts.form.elements[vals[i].name].getAttribute ('id') == 'code-body') {
							// Set the contents of codemirror editor
							_codemirror.setValue (vals[i].value);
						} else if ($(opts.form.elements[vals[i].name]).data ('codemirror')) {
							// Set the contents of codemirror editor
							$.codemirror[opts.form.elements[vals[i].name].getAttribute ('id')].setValue (vals[i].value);
						} else if (opts.form.elements[vals[i].name].getAttribute ('id') == 'tags') {
							// Set the contents of tag-it widget
							$('#tagit').tagit ('removeAll');
							var tags = vals[i].value.split (',');
							for (var t = 0; t < tags.length; t++) {
								$('#tagit').tagit ('createTag', tags[t]);
							}
						}
					} catch (e) {}
				}

				// Clear the key
				$.jStorage.deleteKey (autosave_key_name);

				// Hide the restore notice
				$('.autosave-notice').slideUp ('slow');
				return false;
			});

			// Add a focus handler that triggers saving only once the form is active
			for (var i = 0; i < options.form.elements.length; i++) {
				$(options.form.elements[i]).focus (function () {
					autosave_focused = true;
				});
			}

			// Don't set the interval more than once
			if (autosave_interval != null) {
				return;
			}

			// Set an interval to save the form data
			autosave_interval = setInterval (function () {
				if (autosave_focused === false) {
					return;
				}

				var i = 0,
					opts = options,
					vals = [];

				for (i = 0; i < opts.form.elements.length; i++) {
					if (! opts.form.elements[i].name) {
						// Unnamed fields can be ignored (submit buttons)
						continue;
					}
					if (opts.form.elements[i].getAttribute ('data-wysiwyg') == 1) {
						// Get the contents from Redactor editor
						try {
							var id = opts.form.elements[i].getAttribute ('id')
							vals[i] = {
								name: opts.form.elements[i].name,
								value: $('#' + id).redactor ('code.get')
							};
						} catch (e) {}
					} else if (opts.form.elements[i].getAttribute ('id') == 'code-body') {
						// Get the contents from codemirror editor
						vals[i] = {
							name: opts.form.elements[i].name,
							value: _codemirror.getValue ()
						};
					} else if ($(opts.form.elements[i]).data ('codemirror')) {
						// Get the contents from codemirror editor
						vals[i] = {
							name: opts.form.elements[i].name,
							value: $.codemirror[opts.form.elements[i].getAttribute ('id')].getValue ()
						};
					} else if ($(opts.form.elements[i]).is (':radio') || $(opts.form.elements[i]).is (':checkbox')) {
						if (opts.form.elements[i].checked) {
							vals[i] = {
								name: opts.form.elements[i].name,
								value: true
							};
						} else {
							vals[i] = {
								name: opts.form.elements[i].name,
								value: false
							};
						}
					} else {
						// Get the contents from the field itself
						vals[i] = {
							name: opts.form.elements[i].name,
							value: opts.form.elements[i].value
						};
					}
				}

				var _json = JSON.stringify (vals);
				$.jStorage.set (autosave_key_name, lzw_encode (_json));
			}, options.interval);
		}
	});
})(jQuery);

// The following are from http://jsolait.net/

// LZW-compress a string
function lzw_encode(s) {
    var dict = {};
    var data = (s + "").split("");
    var out = [];
    var currChar;
    var phrase = data[0];
    var code = 256;
    for (var i=1; i<data.length; i++) {
        currChar=data[i];
        if (dict[phrase + currChar] != null) {
            phrase += currChar;
        }
        else {
            out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0));
            dict[phrase + currChar] = code;
            code++;
            phrase=currChar;
        }
    }
    out.push(phrase.length > 1 ? dict[phrase] : phrase.charCodeAt(0));
    for (var i=0; i<out.length; i++) {
        out[i] = String.fromCharCode(out[i]);
    }
    return out.join("");
}

// Decompress an LZW-encoded string
function lzw_decode(s) {
    var dict = {};
    var data = (s + "").split("");
    var currChar = data[0];
    var oldPhrase = currChar;
    var out = [currChar];
    var code = 256;
    var phrase;
    for (var i=1; i<data.length; i++) {
        var currCode = data[i].charCodeAt(0);
        if (currCode < 256) {
            phrase = data[i];
        }
        else {
           phrase = dict[currCode] ? dict[currCode] : (oldPhrase + currChar);
        }
        out.push(phrase);
        currChar = phrase.charAt(0);
        dict[code] = oldPhrase + currChar;
        code++;
        oldPhrase = phrase;
    }
    return out.join("");
}
<|endoftext|>


<commit_before>import eventEmitter from 'event-emitter';
import Vue from 'vue';

let singletonInstance = null;

export default class GlobalApi {
    constructor() {
        eventEmitter(this);
        this.state = null;
        this.themes = null;
        this.controlInputPlugins = [];
        this.stateBrowserPlugins = [];
        this.channelHeadPlugins = [];
        this.privateHeadPlugins = [];
        this.windows = {};
    }

    static singleton() {
        singletonInstance = singletonInstance || new GlobalApi();
        return singletonInstance;
    }

    setState(state) {
        this.state = state;
        this.state.$on('controlinput:show', e => {
            this.controlInputPlugins.forEach(el => e.controlinput.addPlugin(el));
        });
        this.state.$on('statebrowser:show', e => {
            this.stateBrowserPlugins.forEach(el => e.statebrowser.addPlugin(el));
        });
        this.state.$on('containerheader:show', e => {
            if (e.container.isChannel()) {
                this.channelHeadPlugins.forEach(el => e.container.addPlugin(el));
            }
            if (e.container.isQuery()) {
                this.privateHeadPlugins.forEach(el => e.container.addPlugin(el));
            }
        });
    }

    setThemeManager(themeManager) {
        this.themes = themeManager;
    }

    changeWindow(name) {
        this.state.$emit('active.component', this.windows[name]);
    }

    addPlugin(type, element, opts) {
        switch (type) {
        case 'controlinput':
            this.controlInputPlugins.push(element);
            break;
        case 'statebrowser':
            this.stateBrowserPlugins.push(element);
            break;
        case 'channelhead':
            this.channelHeadPlugins.push(element);
            break;
        case 'privatehead':
            this.privateHeadPlugins.push(element);
            break;
        case 'window':
            this.windows[element] = Vue.component(element, opts || {});
            break;
        default:
            break;
        }
    }

    addStartup(name, ctor) {
        let startups = this.state.getStartups();
        startups[name] = ctor;
    }
}
<commit_msg>Renaming windows to tabs and window to tab.<commit_after>import eventEmitter from 'event-emitter';
import Vue from 'vue';

let singletonInstance = null;

export default class GlobalApi {
    constructor() {
        eventEmitter(this);
        this.state = null;
        this.themes = null;
        this.controlInputPlugins = [];
        this.stateBrowserPlugins = [];
        this.channelHeadPlugins = [];
        this.privateHeadPlugins = [];
        this.tabs = Object.create(null);
    }

    static singleton() {
        singletonInstance = singletonInstance || new GlobalApi();
        return singletonInstance;
    }

    setState(state) {
        this.state = state;
        this.state.$on('controlinput:show', e => {
            this.controlInputPlugins.forEach(el => e.controlinput.addPlugin(el));
        });
        this.state.$on('statebrowser:show', e => {
            this.stateBrowserPlugins.forEach(el => e.statebrowser.addPlugin(el));
        });
        this.state.$on('containerheader:show', e => {
            if (e.container.isChannel()) {
                this.channelHeadPlugins.forEach(el => e.container.addPlugin(el));
            }
            if (e.container.isQuery()) {
                this.privateHeadPlugins.forEach(el => e.container.addPlugin(el));
            }
        });
    }

    setThemeManager(themeManager) {
        this.themes = themeManager;
    }

    changeWindow(name) {
        this.state.$emit('active.component', this.tabs[name]);
    }

    addPlugin(type, element, opts) {
        switch (type) {
        case 'controlinput':
            this.controlInputPlugins.push(element);
            break;
        case 'statebrowser':
            this.stateBrowserPlugins.push(element);
            break;
        case 'channelhead':
            this.channelHeadPlugins.push(element);
            break;
        case 'privatehead':
            this.privateHeadPlugins.push(element);
            break;
        case 'tab':
            this.tabs[element] = Vue.component(element, opts || {});
            break;
        default:
            break;
        }
    }

    addStartup(name, ctor) {
        let startups = this.state.getStartups();
        startups[name] = ctor;
    }
}
<|endoftext|>


<commit_before>/*
 * Splunk patterns
 *
 * @author Xander Johnson (metasyn)
 * @version 0.0.1
 */
Rainbow.extend('splunk', [
    {
        'name': 'command',
        'pattern': /\b(abstract|accum|addcoltotals|addinfo|addtotals|analyzefields|anomalies|anomalousvalue|append|appendcols|appendpipe|arules|associate|audit|autoregress|bin|bucket|bucketdir|chart|cluster|cofilter|collect|concurrency|contingency|convert|correlate|crawl|datamodel|dbinspect|dedup|delete|delta|diff|erex|eval|eventcount|eventstats|extract|(kv)|fieldformat|fields|fieldsummary|filldown|fillnull|findkeywords|findtypes|folderize|foreach|format|gauge|gentimes|geostats|head|highlight|history|iconify|input|inputcsv|inputlookup|iplocation|join|kmeans|kvform|loadjob|localize|localop|lookup|makecontinuous|makemv|map|metadata|metasearch|multikv|multisearch|mvcombine|mvexpand|nomv|outlier|outputcsv|outputlookup|outputtext|overlap|pivot|predict|rangemap|rare|regex|relevancy|reltime|rename|replace|rest|return|reverse|rex|rtorder|run|savedsearch|script|scrub|search|searchtxn|selfjoin|set|setfields|sendemail|sichart|sirare|sistats|sitimechart|sitop|sort|spath|stats|strcat|streamstats|table|tags|tail|timechart|top|transaction|transpose|trendline|tscollect|tstats|typeahead|typelearner|typer|uniq|untable|where|x11|xmlkv|xmlunescape|xpath|xyseries)/g
    },
    {
        'name': 'eval.function',
        'pattern': /\b(trim|upper|pow|random|substr|replace|isnull|urldecode|null|searchmatch|if|relative_time|log|floor|ln|mvjoin|strptime|sqrt|coalesce|abs|split|pi|nullif|match|cidrmatch|ltrim|isint|mvfilter|max|len|ceil|isnotnull|tonumber|rtrim|validate|now|exact|md5|case|lower|mvindex|like|mvcount|isstr|min|isnum|isbool|substr|typeof|exp|time|tostring|round|strftime)(?=\()/g
    },
    {
        'name': 'stats.function',
        'patern': /\b(avg|count|dc|first|last|list|max|median|min|mode|perc|range|stdev|stdevp|sum|sumsq|values|var)(?=\()/g
    },
    {
        'name': 'splunk.clause',
        'pattern': /\b(to|as|by|over|output)/g
    },
    {
        'name': 'splunk.strptime',
        'pattern': /(%E|%H|%I|%k|%M|%N|%p|%Q|%S|%s|%T|%Z|%z|%%|%F|%A|%a|%d|%e|%j|%w|%b|%B|%m|%y|%Y)/g
    },
    {
        'name': 'splunk.default.fields',
        'pattern': /\b(host|source|sourcetype)/g
    },
    {
        'name': 'constant.language',
        'pattern': /(true|false)/g
    }
], false);
<commit_msg>remove strptime portion, add index to variable.global<commit_after>/*
 * Splunk patterns
 *
 * @author Xander Johnson (metasyn)
 * @version 0.0.1
 */
Rainbow.extend('splunk', [
    {
        'name': 'keyword',
        'pattern': /\b(abstract|accum|addcoltotals|addinfo|addtotals|analyzefields|anomalies|anomalousvalue|append|appendcols|appendpipe|arules|associate|audit|autoregress|bin|bucket|bucketdir|chart|cluster|cofilter|collect|concurrency|contingency|convert|correlate|crawl|datamodel|dbinspect|dedup|delete|delta|diff|erex|eval|eventcount|eventstats|extract|(kv)|fieldformat|fields|fieldsummary|filldown|fillnull|findkeywords|findtypes|folderize|foreach|format|gauge|gentimes|geostats|head|highlight|history|iconify|input|inputcsv|inputlookup|iplocation|join|kmeans|kvform|loadjob|localize|localop|lookup|makecontinuous|makemv|map|metadata|metasearch|multikv|multisearch|mvcombine|mvexpand|nomv|outlier|outputcsv|outputlookup|outputtext|overlap|pivot|predict|rangemap|rare|regex|relevancy|reltime|rename|replace|rest|return|reverse|rex|rtorder|run|savedsearch|script|scrub|search|searchtxn|selfjoin|set|setfields|sendemail|sichart|sirare|sistats|sitimechart|sitop|sort|spath|stats|strcat|streamstats|table|tags|tail|timechart|top|transaction|transpose|trendline|tscollect|tstats|typeahead|typelearner|typer|uniq|untable|where|x11|xmlkv|xmlunescape|xpath|xyseries)/g
    },
    {
        'name': 'support.function',
        'pattern': /\b(trim|upper|pow|random|substr|replace|isnull|urldecode|null|searchmatch|if|relative_time|log|floor|ln|mvjoin|strptime|sqrt|coalesce|abs|split|pi|nullif|match|cidrmatch|ltrim|isint|mvfilter|max|len|ceil|isnotnull|tonumber|rtrim|validate|now|exact|md5|case|lower|mvindex|like|mvcount|isstr|min|isnum|isbool|substr|typeof|exp|time|tostring|round|strftime)(?=\()/g
    },
    {
        'name': 'support.function',
        'patern': /\b(avg|count|dc|first|last|list|max|median|min|mode|perc|range|stdev|stdevp|sum|sumsq|values|var)(?=\()/g
    },
    {
        'name': 'constant.language',
        'pattern': /\b(to|as|by|over|output)/g
    },
    {
        'name': 'variable.global',
        'pattern': /\b(host|source|sourcetype|index)/g
    }
], false);
<|endoftext|>


<commit_before>/*globals define*/
define(function( require ) {
  'use strict';

  var Utils = require( 'utils' );
  var LevelUtils = require( 'levels/utils-level' );

  var Door = require( 'entities/door' );
  var Laser = require( 'entities/laser' );
  var Emitter = require( 'entities/emitter' );
  var Trigger = require( 'entities/trigger' );
  var TriggerWire = require( 'effects/trigger-wire' );

  var Material = require( 'config/material' );

  var DEG_TO_RAD = Utils.DEG_TO_RAD;

  var level02Data = require( 'text!../../json/level-02.json' );
  var level03 = require( 'levels/level-03' );

  return function( game ) {
    game.clear();

    game.player.x = 60;
    game.player.y = -40;
    game.material = Material.ANTIMATTER;

    LevelUtils.playerMaterialOn( game );
    LevelUtils.addTrail( game );
    LevelUtils.addBackground( game, 96, 75, 32, 1 );
    LevelUtils.loadData( game, level02Data );

    game.camera.setHeight( 48, {
      maintainAspectRatio: true
    });

    // Emitters.
    var trashM = LevelUtils.normalTrash( Material.MATTER );

    var em0 = new Emitter( 70, -40 );
    em0.spawnArea = LevelUtils.normalSpawnArea(4);
    em0.rate = 0.2;
    em0.lifeTime = 6;
    em0.speed = 100;
    em0.angle = -180 * DEG_TO_RAD;

    em0.particle = trashM;
    em0.properties = LevelUtils.normalTrashProperties( trashM, Material.MATTER );
    em0.properties.body.linearDamping = 0;

    em0.start();
    game.add( em0 );

    // Lasers.
    var laser0 = new Laser( 44, -59, Material.MATTER );
    laser0.angle = -90 * DEG_TO_RAD;
    game.add( laser0 );

    var laser1 = new Laser( 14, -59, Material.MATTER );
    laser1.angle = -90 * DEG_TO_RAD;
    game.add( laser1 );

    var laser2 = new Laser( -16, -57, Material.MATTER );
    laser2.angle = -90 * DEG_TO_RAD;
    game.add( laser2 );

    // Trigger.
    var trig0 = new Trigger( -60, -40, 3, Material.MATTER );
    game.add( trig0 );

    // Door.
    var door = new Door( -45, -17, 3, {
      callback: function() {
        level03( game );
      }
    });

    door.triggers.push( trig0 );
    game.add( door );

    // Trigger wire.
    var triggerWire = new TriggerWire( trig0, door, {
      vertices: [
        0.4, 0,
        0.4, 0.5,
        1, 0.5
      ],
      sourceDirection: TriggerWire.Direction.RIGHT,
      targetDirection: TriggerWire.Direction.TOP
    });
    game.add( triggerWire );
  };
});
<commit_msg>Increase fire rate of Level 02 emitter.<commit_after>/*globals define*/
define(function( require ) {
  'use strict';

  var Utils = require( 'utils' );
  var LevelUtils = require( 'levels/utils-level' );

  var Door = require( 'entities/door' );
  var Laser = require( 'entities/laser' );
  var Emitter = require( 'entities/emitter' );
  var Trigger = require( 'entities/trigger' );
  var TriggerWire = require( 'effects/trigger-wire' );

  var Material = require( 'config/material' );

  var DEG_TO_RAD = Utils.DEG_TO_RAD;

  var level02Data = require( 'text!../../json/level-02.json' );
  var level03 = require( 'levels/level-03' );

  return function( game ) {
    game.clear();

    game.player.x = 60;
    game.player.y = -40;
    game.material = Material.ANTIMATTER;

    LevelUtils.playerMaterialOn( game );
    LevelUtils.addTrail( game );
    LevelUtils.addBackground( game, 96, 75, 32, 1 );
    LevelUtils.loadData( game, level02Data );

    game.camera.setHeight( 48, {
      maintainAspectRatio: true
    });

    // Emitters.
    var trashM = LevelUtils.normalTrash( Material.MATTER );

    var em0 = new Emitter( 70, -40 );
    em0.spawnArea = LevelUtils.normalSpawnArea(4);
    em0.rate = 0.1;
    em0.lifeTime = 6;
    em0.speed = 100;
    em0.angle = -180 * DEG_TO_RAD;

    em0.particle = trashM;
    em0.properties = LevelUtils.normalTrashProperties( trashM, Material.MATTER );
    em0.properties.body.linearDamping = 0;

    em0.start();
    game.add( em0 );

    // Lasers.
    var laser0 = new Laser( 44, -59, Material.MATTER );
    laser0.angle = -90 * DEG_TO_RAD;
    game.add( laser0 );

    var laser1 = new Laser( 14, -59, Material.MATTER );
    laser1.angle = -90 * DEG_TO_RAD;
    game.add( laser1 );

    var laser2 = new Laser( -16, -57, Material.MATTER );
    laser2.angle = -90 * DEG_TO_RAD;
    game.add( laser2 );

    // Trigger.
    var trig0 = new Trigger( -60, -40, 3, Material.MATTER );
    game.add( trig0 );

    // Door.
    var door = new Door( -45, -17, 3, {
      callback: function() {
        level03( game );
      }
    });

    door.triggers.push( trig0 );
    game.add( door );

    // Trigger wire.
    var triggerWire = new TriggerWire( trig0, door, {
      vertices: [
        0.4, 0,
        0.4, 0.5,
        1, 0.5
      ],
      sourceDirection: TriggerWire.Direction.RIGHT,
      targetDirection: TriggerWire.Direction.TOP
    });
    game.add( triggerWire );
  };
});
<|endoftext|>


<commit_before>/*!
 * Mobiscroll v2.14.4
 * http://mobiscroll.com
 *
 * Copyright 2010-2014, Acid Media
 * Licensed under the MIT license.
 *
 */
(function ($, undefined) {

    function testProps(props) {
        var i;
        for (i in props) {
            if (mod[props[i]] !== undefined) {
                return true;
            }
        }
        return false;
    }

    function testPrefix() {
        var prefixes = ['Webkit', 'Moz', 'O', 'ms'],
            p;

        for (p in prefixes) {
            if (testProps([prefixes[p] + 'Transform'])) {
                return '-' + prefixes[p].toLowerCase() + '-';
            }
        }
        return '';
    }

    function init(that, options, args) {
        var ret = that;

        // Init
        if (typeof options === 'object') {
            return that.each(function () {
                if (instances[this.id]) {
                    instances[this.id].destroy();
                }
                new $.mobiscroll.classes[options.component || 'Scroller'](this, options);
            });
        }

        // Method call
        if (typeof options === 'string') {
            that.each(function () {
                var r,
                    inst = instances[this.id];

                if (inst && inst[options]) {
                    r = inst[options].apply(this, Array.prototype.slice.call(args, 1));
                    if (r !== undefined) {
                        ret = r;
                        return false;
                    }
                }
            });
        }

        return ret;
    }

    var id = +new Date(),
        instances = {},
        extend = $.extend,
        mod = document.createElement('modernizr').style,
        has3d = testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']),
        hasFlex = testProps(['flex', 'msFlex', 'WebkitBoxDirection']),
        prefix = testPrefix(),
        pr = prefix.replace(/^\-/, '').replace(/\-$/, '').replace('moz', 'Moz');

    $.fn.mobiscroll = function (method) {
        extend(this, $.mobiscroll.components);
        return init(this, method, arguments);
    };

    $.mobiscroll = $.mobiscroll || {
        version: '2.14.4',
        util: {
            prefix: prefix,
            jsPrefix: pr,
            has3d: has3d,
            hasFlex: hasFlex,
            testTouch: function (e, elm) {
                if (e.type == 'touchstart') {
                    $(elm).attr('data-touch', '1');
                } else if ($(elm).attr('data-touch')) {
                    $(elm).removeAttr('data-touch');
                    return false;
                }
                return true;
            },
            objectToArray: function (obj) {
                var arr = [],
                    i;

                for (i in obj) {
                    arr.push(obj[i]);
                }

                return arr;
            },
            arrayToObject: function (arr) {
                var obj = {},
                    i;

                if (arr) {
                    for (i = 0; i < arr.length; i++) {
                        obj[arr[i]] = arr[i];
                    }
                }

                return obj;
            },
            isNumeric: function (a) {
                return a - parseFloat(a) >= 0;
            },
            isString: function (s) {
                return typeof s === 'string';
            },
            getCoord: function (e, c) {
                var ev = e.originalEvent || e;
                return ev.changedTouches ? ev.changedTouches[0]['page' + c] : e['page' + c];
            },
            getPosition: function (t, vertical) {
                var style = window.getComputedStyle ? getComputedStyle(t[0]) : t[0].style,
                    matrix,
                    px;

                if (has3d) {
                    $.each(['t', 'webkitT', 'MozT', 'OT', 'msT'], function (i, v) {
                        if (style[v + 'ransform'] !== undefined) {
                            matrix = style[v + 'ransform'];
                            return false;
                        }
                    });
                    matrix = matrix.split(')')[0].split(', ');
                    px = vertical ? (matrix[13] || matrix[5]) : (matrix[12] || matrix[4]);
                } else {
                    px = vertical ? style.top.replace('px', '') : style.left.replace('px', '');
                }

                return px;
            },
            constrain: function (val, min, max) {
                return Math.max(min, Math.min(val, max));
            },
            vibrate: function (time) {
                navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate;

                if ('vibrate' in navigator) {
                    navigator.vibrate(time || 100);
                }
            }
        },
        tapped: false,
        autoTheme: 'mobiscroll',
        presets: {
            scroller: {},
            numpad: {},
            listview: {},
            menustrip: {}
        },
        themes: {
            widget: {},
            listview: {},
            menustrip: {}
        },
        i18n: {},
        instances: instances,
        classes: {},
        components: {},
        defaults: {
            context: 'body',
            vibrate: true
        },
        setDefaults: function (o) {
            extend(this.defaults, o);
        },
        presetShort: function (name, c, p) {
            this.components[name] = function (s) {
                return init(this, extend(s, { component: c, preset: p === false ? undefined : name }), arguments);
            };
        }
    };

    $.mobiscroll.classes.Base = function (el, settings) {

        var lang,
            preset,
            s,
            theme,
            themeName,
            defaults,
            ms = $.mobiscroll,
            that = this;

        that.settings = {};

        that._presetLoad = function () {};

        that._init = function (ss) {
            s = that.settings;

            // Update original user settings
            extend(settings, ss);

            // Load user defaults
            if (that._hasDef) {
                defaults = ms.defaults;
            }

            // Create settings object
            extend(s, that._defaults, defaults, settings);

            // Get theme defaults
            if (that._hasTheme) {

                themeName = s.theme;

                if (themeName == 'auto' || !themeName) {
                    themeName = ms.autoTheme;
                }

                if (themeName == 'default') {
                    themeName = 'mobiscroll';
                }

                settings.theme = themeName;

                theme = ms.themes[that._class][themeName];
            }

            // Get language defaults
            if (that._hasLang) {
                lang = ms.i18n[s.lang];
            }

            if (that._hasTheme) {
                that.trigger('onThemeLoad', [lang, settings]);
            }

            // Update settings object
            extend(s, theme, lang, defaults, settings);

            // Load preset settings
            if (that._hasPreset) {

                that._presetLoad(s);

                preset = ms.presets[that._class][s.preset];

                if (preset) {
                    preset = preset.call(el, that);
                    extend(s, preset, settings);
                }
            }
        };

        that._destroy = function () {
            that.trigger('onDestroy', []);

            // Delete scroller instance
            delete instances[el.id];

            that = null;
        };

        /**
         * Triggers an event
         */
        that.trigger = function (name, args) {
            var ret;
            args.push(that);
            $.each([defaults, theme, preset, settings], function (i, v) {
                if (v && v[name]) { // Call preset event
                    ret = v[name].apply(el, args);
                }
            });
            return ret;
        };

        /**
         * Sets one ore more options.
         */
        that.option = function (opt, value) {
            var obj = {};
            if (typeof opt === 'object') {
                obj = opt;
            } else {
                obj[opt] = value;
            }
            that.init(obj);
        };

        /**
         * Returns the mobiscroll instance.
         */
        that.getInst = function () {
            return that;
        };

        settings = settings || {};

        // Autogenerate id
        if (!el.id) {
            el.id = 'mobiscroll' + (++id);
        }

        // Save instance
        instances[el.id] = that;
    };

})(jQuery);
<commit_msg>vibration changes<commit_after>/*!
 * Mobiscroll v2.14.4
 * http://mobiscroll.com
 *
 * Copyright 2010-2014, Acid Media
 * Licensed under the MIT license.
 *
 */
(function ($, undefined) {

    function testProps(props) {
        var i;
        for (i in props) {
            if (mod[props[i]] !== undefined) {
                return true;
            }
        }
        return false;
    }

    function testPrefix() {
        var prefixes = ['Webkit', 'Moz', 'O', 'ms'],
            p;

        for (p in prefixes) {
            if (testProps([prefixes[p] + 'Transform'])) {
                return '-' + prefixes[p].toLowerCase() + '-';
            }
        }
        return '';
    }

    function init(that, options, args) {
        var ret = that;

        // Init
        if (typeof options === 'object') {
            return that.each(function () {
                if (instances[this.id]) {
                    instances[this.id].destroy();
                }
                new $.mobiscroll.classes[options.component || 'Scroller'](this, options);
            });
        }

        // Method call
        if (typeof options === 'string') {
            that.each(function () {
                var r,
                    inst = instances[this.id];

                if (inst && inst[options]) {
                    r = inst[options].apply(this, Array.prototype.slice.call(args, 1));
                    if (r !== undefined) {
                        ret = r;
                        return false;
                    }
                }
            });
        }

        return ret;
    }

    var id = +new Date(),
        instances = {},
        extend = $.extend,
        mod = document.createElement('modernizr').style,
        has3d = testProps(['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']),
        hasFlex = testProps(['flex', 'msFlex', 'WebkitBoxDirection']),
        prefix = testPrefix(),
        pr = prefix.replace(/^\-/, '').replace(/\-$/, '').replace('moz', 'Moz');

    $.fn.mobiscroll = function (method) {
        extend(this, $.mobiscroll.components);
        return init(this, method, arguments);
    };

    $.mobiscroll = $.mobiscroll || {
        version: '2.14.4',
        util: {
            prefix: prefix,
            jsPrefix: pr,
            has3d: has3d,
            hasFlex: hasFlex,
            testTouch: function (e, elm) {
                if (e.type == 'touchstart') {
                    $(elm).attr('data-touch', '1');
                } else if ($(elm).attr('data-touch')) {
                    $(elm).removeAttr('data-touch');
                    return false;
                }
                return true;
            },
            objectToArray: function (obj) {
                var arr = [],
                    i;

                for (i in obj) {
                    arr.push(obj[i]);
                }

                return arr;
            },
            arrayToObject: function (arr) {
                var obj = {},
                    i;

                if (arr) {
                    for (i = 0; i < arr.length; i++) {
                        obj[arr[i]] = arr[i];
                    }
                }

                return obj;
            },
            isNumeric: function (a) {
                return a - parseFloat(a) >= 0;
            },
            isString: function (s) {
                return typeof s === 'string';
            },
            getCoord: function (e, c) {
                var ev = e.originalEvent || e;
                return ev.changedTouches ? ev.changedTouches[0]['page' + c] : e['page' + c];
            },
            getPosition: function (t, vertical) {
                var style = window.getComputedStyle ? getComputedStyle(t[0]) : t[0].style,
                    matrix,
                    px;

                if (has3d) {
                    $.each(['t', 'webkitT', 'MozT', 'OT', 'msT'], function (i, v) {
                        if (style[v + 'ransform'] !== undefined) {
                            matrix = style[v + 'ransform'];
                            return false;
                        }
                    });
                    matrix = matrix.split(')')[0].split(', ');
                    px = vertical ? (matrix[13] || matrix[5]) : (matrix[12] || matrix[4]);
                } else {
                    px = vertical ? style.top.replace('px', '') : style.left.replace('px', '');
                }

                return px;
            },
            constrain: function (val, min, max) {
                return Math.max(min, Math.min(val, max));
            },
            vibrate: function (time) {
                if ('vibrate' in navigator) {
                    navigator.vibrate(time || 100);
                }
            }
        },
        tapped: false,
        autoTheme: 'mobiscroll',
        presets: {
            scroller: {},
            numpad: {},
            listview: {},
            menustrip: {}
        },
        themes: {
            widget: {},
            listview: {},
            menustrip: {}
        },
        i18n: {},
        instances: instances,
        classes: {},
        components: {},
        defaults: {
            context: 'body',
            vibrate: true
        },
        setDefaults: function (o) {
            extend(this.defaults, o);
        },
        presetShort: function (name, c, p) {
            this.components[name] = function (s) {
                return init(this, extend(s, { component: c, preset: p === false ? undefined : name }), arguments);
            };
        }
    };

    $.mobiscroll.classes.Base = function (el, settings) {

        var lang,
            preset,
            s,
            theme,
            themeName,
            defaults,
            ms = $.mobiscroll,
            that = this;

        that.settings = {};

        that._presetLoad = function () {};

        that._init = function (ss) {
            s = that.settings;

            // Update original user settings
            extend(settings, ss);

            // Load user defaults
            if (that._hasDef) {
                defaults = ms.defaults;
            }

            // Create settings object
            extend(s, that._defaults, defaults, settings);

            // Get theme defaults
            if (that._hasTheme) {

                themeName = s.theme;

                if (themeName == 'auto' || !themeName) {
                    themeName = ms.autoTheme;
                }

                if (themeName == 'default') {
                    themeName = 'mobiscroll';
                }

                settings.theme = themeName;

                theme = ms.themes[that._class][themeName];
            }

            // Get language defaults
            if (that._hasLang) {
                lang = ms.i18n[s.lang];
            }

            if (that._hasTheme) {
                that.trigger('onThemeLoad', [lang, settings]);
            }

            // Update settings object
            extend(s, theme, lang, defaults, settings);

            // Load preset settings
            if (that._hasPreset) {

                that._presetLoad(s);

                preset = ms.presets[that._class][s.preset];

                if (preset) {
                    preset = preset.call(el, that);
                    extend(s, preset, settings);
                }
            }
        };

        that._destroy = function () {
            that.trigger('onDestroy', []);

            // Delete scroller instance
            delete instances[el.id];

            that = null;
        };

        /**
         * Triggers an event
         */
        that.trigger = function (name, args) {
            var ret;
            args.push(that);
            $.each([defaults, theme, preset, settings], function (i, v) {
                if (v && v[name]) { // Call preset event
                    ret = v[name].apply(el, args);
                }
            });
            return ret;
        };

        /**
         * Sets one ore more options.
         */
        that.option = function (opt, value) {
            var obj = {};
            if (typeof opt === 'object') {
                obj = opt;
            } else {
                obj[opt] = value;
            }
            that.init(obj);
        };

        /**
         * Returns the mobiscroll instance.
         */
        that.getInst = function () {
            return that;
        };

        settings = settings || {};

        // Autogenerate id
        if (!el.id) {
            el.id = 'mobiscroll' + (++id);
        }

        // Save instance
        instances[el.id] = that;
    };

})(jQuery);
<|endoftext|>


<commit_before>/*jshint node:true*/
/* global require, module */
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const replace = require( 'broccoli-string-replace' );
const env = require( './config/environment' );
const packageConfig = require( './package.json' );

module.exports = function( defaults ) {
    const app = new EmberAddon( defaults, {
        babel: {
          includePolyfill: true
        },

        fingerprint: {
            enabled: true,
            exclude: [],
            extensions: [ 'png', 'jpg', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2' ],
            prepend: env().baseAssetsURL,
            replaceExtensions: [ 'html', 'css', 'js' ]
        }
    });

    /*
    This build file specifes the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
    */

    // Development dependencies
    app.import( app.bowerDirectory + '/ember/ember-template-compiler.js', {
        type: 'test'
    });

    const tree = replace( app.toTree(), {
        files: [
            'index.html',
            'assets/dummy.js'
        ],

        patterns: [
            {
                match: /REPLACE_META_DESCRIPTION/g,
                replacement: packageConfig[ 'description' ]
            }, {
                match: /REPLACE_META_KEYWORDS/g,
                replacement: packageConfig[ 'keywords' ].join( ', ' ) + ', ember, ember cli'
            }, {
                match: /REPLACE_APPLICATION_VERSION/g,
                replacement: packageConfig[ 'version' ]
            }
        ]
    });

    return tree;
};
<commit_msg>Temporary(?) change due to ember-cli-babel bug<commit_after>/*jshint node:true*/
/* global require, module */
const EmberAddon = require('ember-cli/lib/broccoli/ember-addon');
const replace = require( 'broccoli-string-replace' );
const env = require( './config/environment' );
const packageConfig = require( './package.json' );

module.exports = function( defaults ) {
    const app = new EmberAddon( defaults, {
        babel: {
            browserPolyfill: true
        },

        fingerprint: {
            enabled: true,
            exclude: [],
            extensions: [ 'png', 'jpg', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2' ],
            prepend: env().baseAssetsURL,
            replaceExtensions: [ 'html', 'css', 'js' ]
        }
    });

    /*
    This build file specifes the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
    */

    // Development dependencies
    app.import( app.bowerDirectory + '/ember/ember-template-compiler.js', {
        type: 'test'
    });

    const tree = replace( app.toTree(), {
        files: [
            'index.html',
            'assets/dummy.js'
        ],

        patterns: [
            {
                match: /REPLACE_META_DESCRIPTION/g,
                replacement: packageConfig[ 'description' ]
            }, {
                match: /REPLACE_META_KEYWORDS/g,
                replacement: packageConfig[ 'keywords' ].join( ', ' ) + ', ember, ember cli'
            }, {
                match: /REPLACE_APPLICATION_VERSION/g,
                replacement: packageConfig[ 'version' ]
            }
        ]
    });

    return tree;
};
<|endoftext|>


<commit_before>// Copyright 2002-2014, University of Colorado Boulder

/**
 * General constants for Fraction Matcher.  While constants, they are extended by MixedNumberConstants, so they should be instantiated
 * like instance objects.  See https://github.com/phetsims/fraction-matcher/issues/43
 *
 * @author Andrey Zelenkov (Mlearner)
 */
define( function( require ) {
  'use strict';

  // modules
  var FILL_TYPE = require( 'FRACTION_MATCHER/model/FillType' );
  var Fraction = require( 'FRACTION_MATCHER/model/Fraction' );

  //colors
  var COLORS = {
    LIGHT_GREEN: 'rgb(140,198,63)',
    LIGHT_BLUE: '#6acef5',//to match the PhET Logo
    LIGHT_RED: 'rgb(233,69,69)',
    LIGHT_PINK: 'rgb(255,175,175)',
    ORANGE: 'rgb(255,200,0)',
    YELLOW: '#f2e916',//to match the PhET Logo
    GREEN: 'rgb(0,255,0)',
    PINK: 'rgb(255,0,255)'
  };
  COLORS.CIRCLE_COLOR = COLORS.LIGHT_GREEN;
  COLORS.HORIZONTAL_SLICE_COLOR = COLORS.LIGHT_RED;
  COLORS.VERTICAL_SLICE_COLOR = COLORS.LIGHT_BLUE;
  COLORS.NUMBER_LINE = COLORS.LIGHT_GREEN;

  //list of all possible shapes
  var SHAPES = ['PIES', 'HORIZONTAL_BARS', 'VERTICAL_BARS', 'PLUSES', 'GRID', 'PYRAMID', 'POLYGON', 'TETRIS', 'FLOWER', 'LETTER_L_SHAPES', 'INTERLEAVED_L_SHAPES', 'RING_OF_HEXAGONS', 'NINJA_STAR'];

  function Constants() {
    // color constants
    this.COLORS = COLORS;

    // shapes type constants
    this.SHAPES = SHAPES;

    this.LEVEL_DESCRIPTION = [
    /**
     * Level 1
     * No mixed numbers
     * Only “exact” matches will be present. So for instance if there is a 3/6  and a pie with 6 divisions and 3 shaded slices, there will not be a ½  present .  In other words, the numerical representation on this level will exactly match the virtual manipulative.
     * Only numbers/representations ≦ 1 possible on this level
     * “Easy” shapes on this level (not some of the more abstract representations)
     */
      {
        fractions: [
          Fraction.fraction( 1, 2 ),
          Fraction.fraction( 1, 3 ),
          Fraction.fraction( 2, 3 ),
          Fraction.fraction( 1, 4 ),
          Fraction.fraction( 3, 4 ),
          Fraction.fraction( 1, 1 )
        ],
        numericScaleFactors: [1],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0, 3 )
      },
    /**
     * Level 2
     * Reduced fractions possible on this level. So, for instance 3/6 and ½  could both be present.  Or a virtual representation of 3/6 could have the numerical of ½ be its only possible match
     * Still only numbers/representations ≦ 1 possible
     * More shapes can be introduced
     */
      {
        fractions: [
          Fraction.fraction( 1, 2 ),
          Fraction.fraction( 1, 3 ),
          Fraction.fraction( 2, 3 ),
          Fraction.fraction( 2, 4 ),
          Fraction.fraction( 3, 4 ),
          Fraction.fraction( 2, 6 ),
          Fraction.fraction( 3, 6 )
        ],
        numericScaleFactors: [1],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 3:
     * Reduced fractions possible on this level. So, for instance 3/6 and ½  could both be present.  Or a virtual representation of 3/6 could have the numerical of ½ be its only possible match
     * Still only numbers/representations ≦ 1 possible
     * More shapes can be introduced
     */
      {
        fractions: [
          Fraction.fraction( 3, 2 ),
          Fraction.fraction( 4, 3 ),
          Fraction.fraction( 5, 4 ),
          Fraction.fraction( 6, 4 ),
          Fraction.fraction( 7, 4 ),
          Fraction.fraction( 4, 5 ),
          Fraction.fraction( 2, 6 ),
          Fraction.fraction( 3, 6 ),
          Fraction.fraction( 4, 6 ),
          Fraction.fraction( 5, 6 ),
          Fraction.fraction( 7, 6 ),
          Fraction.fraction( 3, 8 ),
          Fraction.fraction( 4, 8 ),
          Fraction.fraction( 5, 8 ),
          Fraction.fraction( 6, 8 ),
          Fraction.fraction( 7, 8 )
        ],
        numericScaleFactors: [1],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 4:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 6, 3 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 2, 9 ),
          Fraction.fraction( 3, 9 ),
          Fraction.fraction( 4, 9 ),
          Fraction.fraction( 6, 9 ),
          Fraction.fraction( 8, 9 )
        ],
        numericScaleFactors: [1, 2],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 5:
     * All representations possible as well as complicated mixed/improper numbers.  Same fractions as level 4 but different representations.
     */
      {
        fractions: [
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 6, 3 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 2, 9 ),
          Fraction.fraction( 3, 9 ),
          Fraction.fraction( 4, 9 ),
          Fraction.fraction( 6, 9 ),
          Fraction.fraction( 8, 9 )
        ],
        numericScaleFactors: [1, 2, 3],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.MIXED],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 6:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 6, 5 ),
          Fraction.fraction( 7, 5 ),
          Fraction.fraction( 8, 5 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 7, 6 ),
          Fraction.fraction( 8, 6 ),
          Fraction.fraction( 9, 6 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 10, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 10, 8 ),
          Fraction.fraction( 11, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 4, 9 ),
          Fraction.fraction( 6, 9 ),
          Fraction.fraction( 8, 9 ),
          Fraction.fraction( 10, 9 ),
          Fraction.fraction( 11, 9 )
        ],
        numericScaleFactors: [1, 4, 5],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.RANDOM],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 7:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 3, 2 ),
          Fraction.fraction( 4, 3 ),
          Fraction.fraction( 5, 3 ),
          Fraction.fraction( 5, 4 ),
          Fraction.fraction( 7, 4 ),
          Fraction.fraction( 6, 5 ),
          Fraction.fraction( 7, 5 ),
          Fraction.fraction( 8, 5 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 7, 6 ),
          Fraction.fraction( 11, 6 )
        ],
        numericScaleFactors: [1, 6, 7],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.RANDOM],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 8:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 8, 7 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 10, 7 ),
          Fraction.fraction( 11, 7 ),
          Fraction.fraction( 12, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 10, 8 ),
          Fraction.fraction( 11, 8 ),
          Fraction.fraction( 12, 8 ),
          Fraction.fraction( 13, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 15, 8 ),
          Fraction.fraction( 10, 9 ),
          Fraction.fraction( 11, 9 ),
          Fraction.fraction( 12, 9 ),
          Fraction.fraction( 13, 9 ),
          Fraction.fraction( 14, 9 ),
          Fraction.fraction( 15, 9 ),
          Fraction.fraction( 16, 9 ),
          Fraction.fraction( 17, 9 )
        ],
        numericScaleFactors: [1, 2, 3, 4, 5, 6, 7, 8, 9],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.RANDOM],
        shapes: SHAPES.slice( 0 )
      }
    ]
  }

  return Constants;
} );<commit_msg>fixed jshint issues<commit_after>// Copyright 2002-2014, University of Colorado Boulder

/**
 * General constants for Fraction Matcher.  While constants, they are extended by MixedNumberConstants, so they should be instantiated
 * like instance objects.  See https://github.com/phetsims/fraction-matcher/issues/43
 *
 * @author Andrey Zelenkov (Mlearner)
 */
define( function( require ) {
  'use strict';

  // modules
  var FILL_TYPE = require( 'FRACTION_MATCHER/model/FillType' );
  var Fraction = require( 'FRACTION_MATCHER/model/Fraction' );

  //colors
  var COLORS = {
    LIGHT_GREEN: 'rgb(140,198,63)',
    LIGHT_BLUE: '#6acef5',//to match the PhET Logo
    LIGHT_RED: 'rgb(233,69,69)',
    LIGHT_PINK: 'rgb(255,175,175)',
    ORANGE: 'rgb(255,200,0)',
    YELLOW: '#f2e916',//to match the PhET Logo
    GREEN: 'rgb(0,255,0)',
    PINK: 'rgb(255,0,255)'
  };
  COLORS.CIRCLE_COLOR = COLORS.LIGHT_GREEN;
  COLORS.HORIZONTAL_SLICE_COLOR = COLORS.LIGHT_RED;
  COLORS.VERTICAL_SLICE_COLOR = COLORS.LIGHT_BLUE;
  COLORS.NUMBER_LINE = COLORS.LIGHT_GREEN;

  //list of all possible shapes
  var SHAPES = ['PIES', 'HORIZONTAL_BARS', 'VERTICAL_BARS', 'PLUSES', 'GRID', 'PYRAMID', 'POLYGON', 'TETRIS', 'FLOWER', 'LETTER_L_SHAPES', 'INTERLEAVED_L_SHAPES', 'RING_OF_HEXAGONS', 'NINJA_STAR'];

  function Constants() {
    // color constants
    this.COLORS = COLORS;

    // shapes type constants
    this.SHAPES = SHAPES;

    this.LEVEL_DESCRIPTION = [
    /**
     * Level 1
     * No mixed numbers
     * Only “exact” matches will be present. So for instance if there is a 3/6  and a pie with 6 divisions and 3 shaded slices, there will not be a ½  present .  In other words, the numerical representation on this level will exactly match the virtual manipulative.
     * Only numbers/representations ≦ 1 possible on this level
     * “Easy” shapes on this level (not some of the more abstract representations)
     */
      {
        fractions: [
          Fraction.fraction( 1, 2 ),
          Fraction.fraction( 1, 3 ),
          Fraction.fraction( 2, 3 ),
          Fraction.fraction( 1, 4 ),
          Fraction.fraction( 3, 4 ),
          Fraction.fraction( 1, 1 )
        ],
        numericScaleFactors: [1],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0, 3 )
      },
    /**
     * Level 2
     * Reduced fractions possible on this level. So, for instance 3/6 and ½  could both be present.  Or a virtual representation of 3/6 could have the numerical of ½ be its only possible match
     * Still only numbers/representations ≦ 1 possible
     * More shapes can be introduced
     */
      {
        fractions: [
          Fraction.fraction( 1, 2 ),
          Fraction.fraction( 1, 3 ),
          Fraction.fraction( 2, 3 ),
          Fraction.fraction( 2, 4 ),
          Fraction.fraction( 3, 4 ),
          Fraction.fraction( 2, 6 ),
          Fraction.fraction( 3, 6 )
        ],
        numericScaleFactors: [1],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 3:
     * Reduced fractions possible on this level. So, for instance 3/6 and ½  could both be present.  Or a virtual representation of 3/6 could have the numerical of ½ be its only possible match
     * Still only numbers/representations ≦ 1 possible
     * More shapes can be introduced
     */
      {
        fractions: [
          Fraction.fraction( 3, 2 ),
          Fraction.fraction( 4, 3 ),
          Fraction.fraction( 5, 4 ),
          Fraction.fraction( 6, 4 ),
          Fraction.fraction( 7, 4 ),
          Fraction.fraction( 4, 5 ),
          Fraction.fraction( 2, 6 ),
          Fraction.fraction( 3, 6 ),
          Fraction.fraction( 4, 6 ),
          Fraction.fraction( 5, 6 ),
          Fraction.fraction( 7, 6 ),
          Fraction.fraction( 3, 8 ),
          Fraction.fraction( 4, 8 ),
          Fraction.fraction( 5, 8 ),
          Fraction.fraction( 6, 8 ),
          Fraction.fraction( 7, 8 )
        ],
        numericScaleFactors: [1],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 4:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 6, 3 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 2, 9 ),
          Fraction.fraction( 3, 9 ),
          Fraction.fraction( 4, 9 ),
          Fraction.fraction( 6, 9 ),
          Fraction.fraction( 8, 9 )
        ],
        numericScaleFactors: [1, 2],
        fillType: [FILL_TYPE.SEQUENTIAL],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 5:
     * All representations possible as well as complicated mixed/improper numbers.  Same fractions as level 4 but different representations.
     */
      {
        fractions: [
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 6, 3 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 2, 9 ),
          Fraction.fraction( 3, 9 ),
          Fraction.fraction( 4, 9 ),
          Fraction.fraction( 6, 9 ),
          Fraction.fraction( 8, 9 )
        ],
        numericScaleFactors: [1, 2, 3],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.MIXED],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 6:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 6, 5 ),
          Fraction.fraction( 7, 5 ),
          Fraction.fraction( 8, 5 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 7, 6 ),
          Fraction.fraction( 8, 6 ),
          Fraction.fraction( 9, 6 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 10, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 10, 8 ),
          Fraction.fraction( 11, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 4, 9 ),
          Fraction.fraction( 6, 9 ),
          Fraction.fraction( 8, 9 ),
          Fraction.fraction( 10, 9 ),
          Fraction.fraction( 11, 9 )
        ],
        numericScaleFactors: [1, 4, 5],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.RANDOM],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 7:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 3, 2 ),
          Fraction.fraction( 4, 3 ),
          Fraction.fraction( 5, 3 ),
          Fraction.fraction( 5, 4 ),
          Fraction.fraction( 7, 4 ),
          Fraction.fraction( 6, 5 ),
          Fraction.fraction( 7, 5 ),
          Fraction.fraction( 8, 5 ),
          Fraction.fraction( 9, 5 ),
          Fraction.fraction( 7, 6 ),
          Fraction.fraction( 11, 6 )
        ],
        numericScaleFactors: [1, 6, 7],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.RANDOM],
        shapes: SHAPES.slice( 0 )
      },
    /**
     * Level 8:
     * All representations possible as well as complicated mixed/improper numbers
     */
      {
        fractions: [
          Fraction.fraction( 8, 7 ),
          Fraction.fraction( 9, 7 ),
          Fraction.fraction( 10, 7 ),
          Fraction.fraction( 11, 7 ),
          Fraction.fraction( 12, 7 ),
          Fraction.fraction( 13, 7 ),
          Fraction.fraction( 9, 8 ),
          Fraction.fraction( 10, 8 ),
          Fraction.fraction( 11, 8 ),
          Fraction.fraction( 12, 8 ),
          Fraction.fraction( 13, 8 ),
          Fraction.fraction( 14, 8 ),
          Fraction.fraction( 15, 8 ),
          Fraction.fraction( 10, 9 ),
          Fraction.fraction( 11, 9 ),
          Fraction.fraction( 12, 9 ),
          Fraction.fraction( 13, 9 ),
          Fraction.fraction( 14, 9 ),
          Fraction.fraction( 15, 9 ),
          Fraction.fraction( 16, 9 ),
          Fraction.fraction( 17, 9 )
        ],
        numericScaleFactors: [1, 2, 3, 4, 5, 6, 7, 8, 9],
        fillType: [FILL_TYPE.SEQUENTIAL, FILL_TYPE.RANDOM],
        shapes: SHAPES.slice( 0 )
      }
    ];
  }

  return Constants;
} );<|endoftext|>


<commit_before>/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {

  defaults.snippetSearchPaths = ['tests/dummy/app'];
  defaults.snippetPaths = ['tests/dummy/snippets'];

  var app = new EmberApp(defaults, {
    minifyJS: { enabled: false },
    babel: {
      includePolyfill: true
    }
  });

  var bootstrapPath = app.bowerDirectory + '/bootstrap/dist/';
  app.import(bootstrapPath + 'css/bootstrap.css');
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.eot', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.svg', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.ttf', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.woff', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.woff2', { destDir: '/fonts' });

  /*
    This build file specifes the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
  */

  return app.toTree();
};
<commit_msg>remove minifyJS attr<commit_after>/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {

  defaults.snippetSearchPaths = ['tests/dummy/app'];
  defaults.snippetPaths = ['tests/dummy/snippets'];

  var app = new EmberApp(defaults, {
    babel: {
      includePolyfill: true
    }
  });

  var bootstrapPath = app.bowerDirectory + '/bootstrap/dist/';
  app.import(bootstrapPath + 'css/bootstrap.css');
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.eot', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.svg', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.ttf', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.woff', { destDir: '/fonts' });
  app.import(bootstrapPath + 'fonts/glyphicons-halflings-regular.woff2', { destDir: '/fonts' });

  /*
    This build file specifes the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
  */

  return app.toTree();
};
<|endoftext|>