<commit_before>var urlize = (function () {

  // From http://blog.stevenlevithan.com/archives/cross-browser-split
  // modified to not add itself to String.prototype.

  /*!
   * Cross-Browser Split 1.1.1
   * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
   * Available under the MIT License
   * ECMAScript compliant, uniform cross-browser split method
   */

  /**
   * Splits a string into an array of strings using a regex or string separator. Matches of the
   * separator are not included in the result array. However, if `separator` is a regex that contains
   * capturing groups, backreferences are spliced into the result each time `separator` is matched.
   * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
   * cross-browser.
   * @param {String} str String to split.
   * @param {RegExp|String} separator Regex or string to use for separating the string.
   * @param {Number} [limit] Maximum number of items to include in the result array.
   * @returns {Array} Array of substrings.
   * @example
   *
   * // Basic use
   * split('a b c d', ' ');
   * // -> ['a', 'b', 'c', 'd']
   *
   * // With limit
   * split('a b c d', ' ', 2);
   * // -> ['a', 'b']
   *
   * // Backreferences in result array
   * split('..word1 word2..', /([a-z]+)(\d+)/i);
   * // -> ['..', 'word', '1', ' ', 'word', '2', '..']
   */
  var split;

  // Avoid running twice; that would break the `nativeSplit` reference
  split = split || function (undef) {

    var nativeSplit = String.prototype.split,
      compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group
      self;

    self = function (str, separator, limit) {
      // If `separator` is not a regex, use `nativeSplit`
      if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
        return nativeSplit.call(str, separator, limit);
      }

      var output = [],
        flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6
        (separator.sticky ? "y" : ""), // Firefox 3+
        lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy
        separator = new RegExp(separator.source, flags + "g"),
        separator2, match, lastIndex, lastLength;

      str += ""; // Type-convert

      if (!compliantExecNpcg) {
        // Doesn't need flags gy, but they don't hurt
        separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
      }

      /* Values for `limit`, per the spec:
       * If undefined: 4294967295 // Math.pow(2, 32) - 1
       * If 0, Infinity, or NaN: 0
       * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
       * If negative number: 4294967296 - Math.floor(Math.abs(limit))
       * If other: Type-convert, then use the above rules
       */
      limit = limit === undef ?
        -1 >>> 0 : // Math.pow(2, 32) - 1
        limit >>> 0; // ToUint32(limit)

      while (match = separator.exec(str)) {
        // `separator.lastIndex` is not reliable cross-browser
        lastIndex = match.index + match[0].length;
        if (lastIndex > lastLastIndex) {
          output.push(str.slice(lastLastIndex, match.index));
          // Fix browsers whose `exec` methods don't consistently return `undefined` for
          // nonparticipating capturing groups
          if (!compliantExecNpcg && match.length > 1) {
            match[0].replace(separator2, function () {
              for (var i = 1; i < arguments.length - 2; i++) {
                if (arguments[i] === undef) {
                  match[i] = undef;
                }
              }
            });
          }
          if (match.length > 1 && match.index < str.length) {
            Array.prototype.push.apply(output, match.slice(1));
          }
          lastLength = match[0].length;
          lastLastIndex = lastIndex;
          if (output.length >= limit) {
            break;
          }
        }
        if (separator.lastIndex === match.index) {
          separator.lastIndex++; // Avoid an infinite loop
        }
      }
      if (lastLastIndex === str.length) {
        if (lastLength || !separator.test("")) {
          output.push("");
        }
      } else {
        output.push(str.slice(lastLastIndex));
      }
      return output.length > limit ? output.slice(0, limit) : output;
    };

    return self;
  }();

  function startswith(string, prefix) {
    return string.substr(0, prefix.length) == prefix;
  }

  function endswith(string, suffix) {
    return string.substr(string.length - suffix.length, suffix.length) == suffix;
  }

  // http://stackoverflow.com/a/7924240/17498
  function occurrences(string, substring) {
    var n = 0;
    var pos = 0;
    while (true) {
      pos = string.indexOf(substring, pos);
      if (pos != -1) {
        n++;
        pos += substring.length;
      } else {
        break;
      }
    }
    return n;
  }

  var unquoted_percents_re = /%(?![0-9A-Fa-f]{2})/;

  // Quotes a URL if it isn't already quoted.
  function smart_urlquote(url) {
    // XXX: Not handling IDN.
    //
    // Convert protocol to lowercase.
    var colonIndex = url.indexOf(':');
    url = url.substring(0, colonIndex).toLowerCase() + url.substring(colonIndex);
    //
    // An URL is considered unquoted if it contains no % characters or
    // contains a % not followed by two hexadecimal digits.
    if (url.indexOf('%') == -1 || url.match(unquoted_percents_re)) {
      return encodeURI(url);
    } else {
      return url;
    }
  }

  var trailing_punctuation_django = ['.', ',', ':', ';'];
  var trailing_punctuation_improved = ['.', ',', ':', ';', '.)'];
  var wrapping_punctuation_django = [['(', ')'], ['<', '>'], ['<', '>']];
  var wrapping_punctuation_improved = [['(', ')'], ['<', '>'], ['<', '>'],
  				     ['“', '”'], ['‘', '’']];
  var word_split_re_django = /(\s+)/;
  var word_split_re_improved = /([\s<>"]+)/;
  var simple_url_re = /^https?:\/\/\w/i;

  var django_top_level_domains = ['com', 'edu', 'gov', 'int', 'mil', 'net', 'org'];
  var simple_email_re = /^\S+@\S+\.\S+$/;

  function htmlescape(html, options) {
    var escaped = html
      .replace(/&/g, "&")
      .replace(/</g, "<")
      .replace(/>/g, ">")
      .replace(/"/g, """)
      .replace(/'/g, "'");
    if (options && !options.django_compatible) { // only on django_compatible because => https://github.com/ljosa/urlize.js/pull/9
      escaped = escaped.replace(/\//g, "/");
    }
    return escaped;
  }

  function urlescape(url) {
    return url // Do not escape slash, because is used for the http:// part
      .replace(/&/g, "&")
      .replace(/</g, "<")
      .replace(/>/g, ">")
      .replace(/"/g, """);
  }

  function convert_arguments(args) {
    var options;
    if (args.length == 2 && typeof (args[1]) == 'object') {
      options = args[1];
    } else {
      options = {
        nofollow: args[1],
        autoescape: args[2],
        trim_url_limit: args[3],
        target: args[4]
      };
    }
    if (!('django_compatible' in options)) options.django_compatible = true;
    return options;
  }

  function urlize(text, options) {
    options = convert_arguments(arguments);

    function trim_url(x, limit) {
      if (options.trim === "http" || options.trim === "www")
        x = x.replace(/^https?:\/\//i, '');
      if (options.trim === "www")
        x = x.replace(/^www\./i, '');
      if (limit === undefined) limit = options.trim_url_limit;
      if (limit && x.length > limit) return x.substr(0, limit - 3) + '...';
      return x;
    }
    var safe_input = false;
    var word_split_re = options.django_compatible ? word_split_re_django : word_split_re_improved;
    var trailing_punctuation = options.django_compatible ? trailing_punctuation_django : trailing_punctuation_improved;
    var wrapping_punctuation = options.django_compatible ? wrapping_punctuation_django : wrapping_punctuation_improved;
    var simple_url_2_re = new RegExp('^www\\.|^(?!http)\\w[^@]+\\.(' +
                        (options.top_level_domains || django_top_level_domains).join('|') +
                        ')$',
                        "i");
    var words = split(text, word_split_re);
    for (var i = 0; i < words.length; i++) {
      var word = words[i];
      var match = undefined;
      if (word.indexOf('.') != -1 || word.indexOf('@') != -1 || word.indexOf(':') != -1) {
        // Deal with punctuation.
        var lead = '';
        var middle = word;
        var trail = '';
        for (var j = 0; j < trailing_punctuation.length; j++) {
          var punctuation = trailing_punctuation[j];
          if (endswith(middle, punctuation)) {
            middle = middle.substr(0, middle.length - punctuation.length);
            trail = punctuation + trail;
          }
        }
        for (var j = 0; j < wrapping_punctuation.length; j++) {
          var opening = wrapping_punctuation[j][0];
          var closing = wrapping_punctuation[j][1];
          if (startswith(middle, opening)) {
            middle = middle.substr(opening.length);
            lead = lead + opening;
          }
          // Keep parentheses at the end only if they're balanced.
          if (endswith(middle, closing) && occurrences(middle, closing) == occurrences(middle, opening) + 1) {
            middle = middle.substr(0, middle.length - closing.length);
            trail = closing + trail;
          }
        }

        // Make URL we want to point to.
        var url = undefined;
        var nofollow_attr = options.nofollow ? ' rel="nofollow"' : '';
        var target_attr = options.target ? ' target="' + options.target + '"' : '';

        if (middle.match(simple_url_re)) url = smart_urlquote(middle);
        else if (middle.match(simple_url_2_re)) url = smart_urlquote('http://' + middle);
        else if (middle.indexOf(':') == -1 && middle.match(simple_email_re)) {
          // XXX: Not handling IDN.
          url = 'mailto:' + middle;
          nofollow_attr = '';
        }

        // Make link.
        if (url) {
          var trimmed = trim_url(middle);
          if (options.autoescape) {
            // XXX: Assuming autoscape == false
            lead = htmlescape(lead, options);
            trail = htmlescape(trail, options);
            url = urlescape(url);
            trimmed = htmlescape(trimmed, options);
          }
          middle = '' + trimmed + '';
          words[i] = lead + middle + trail;
        } else {
          if (safe_input) {
            // Do nothing, as we have no mark_safe.
          } else if (options.autoescape) {
            words[i] = htmlescape(word, options);
          }
        }
      } else if (safe_input) {
        // Do nothing, as we have no mark_safe.
      } else if (options.autoescape) {
        words[i] = htmlescape(word, options);
      }
    }
    return words.join('');
  }

  urlize.test = {};
  urlize.test.split = split;
  urlize.test.convert_arguments = convert_arguments;

  return urlize;
})();
<commit_msg>자동 링크 '새창으로 열기' 아이콘 추가 #63<commit_after>var urlize = (function () {

  // From http://blog.stevenlevithan.com/archives/cross-browser-split
  // modified to not add itself to String.prototype.

  /*!
   * Cross-Browser Split 1.1.1
   * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
   * Available under the MIT License
   * ECMAScript compliant, uniform cross-browser split method
   */

  /**
   * Splits a string into an array of strings using a regex or string separator. Matches of the
   * separator are not included in the result array. However, if `separator` is a regex that contains
   * capturing groups, backreferences are spliced into the result each time `separator` is matched.
   * Fixes browser bugs compared to the native `String.prototype.split` and can be used reliably
   * cross-browser.
   * @param {String} str String to split.
   * @param {RegExp|String} separator Regex or string to use for separating the string.
   * @param {Number} [limit] Maximum number of items to include in the result array.
   * @returns {Array} Array of substrings.
   * @example
   *
   * // Basic use
   * split('a b c d', ' ');
   * // -> ['a', 'b', 'c', 'd']
   *
   * // With limit
   * split('a b c d', ' ', 2);
   * // -> ['a', 'b']
   *
   * // Backreferences in result array
   * split('..word1 word2..', /([a-z]+)(\d+)/i);
   * // -> ['..', 'word', '1', ' ', 'word', '2', '..']
   */
  var split;

  // Avoid running twice; that would break the `nativeSplit` reference
  split = split || function (undef) {

    var nativeSplit = String.prototype.split,
      compliantExecNpcg = /()??/.exec("")[1] === undef, // NPCG: nonparticipating capturing group
      self;

    self = function (str, separator, limit) {
      // If `separator` is not a regex, use `nativeSplit`
      if (Object.prototype.toString.call(separator) !== "[object RegExp]") {
        return nativeSplit.call(str, separator, limit);
      }

      var output = [],
        flags = (separator.ignoreCase ? "i" : "") + (separator.multiline ? "m" : "") + (separator.extended ? "x" : "") + // Proposed for ES6
        (separator.sticky ? "y" : ""), // Firefox 3+
        lastLastIndex = 0, // Make `global` and avoid `lastIndex` issues by working with a copy
        separator = new RegExp(separator.source, flags + "g"),
        separator2, match, lastIndex, lastLength;

      str += ""; // Type-convert

      if (!compliantExecNpcg) {
        // Doesn't need flags gy, but they don't hurt
        separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
      }

      /* Values for `limit`, per the spec:
       * If undefined: 4294967295 // Math.pow(2, 32) - 1
       * If 0, Infinity, or NaN: 0
       * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
       * If negative number: 4294967296 - Math.floor(Math.abs(limit))
       * If other: Type-convert, then use the above rules
       */
      limit = limit === undef ?
        -1 >>> 0 : // Math.pow(2, 32) - 1
        limit >>> 0; // ToUint32(limit)

      while (match = separator.exec(str)) {
        // `separator.lastIndex` is not reliable cross-browser
        lastIndex = match.index + match[0].length;
        if (lastIndex > lastLastIndex) {
          output.push(str.slice(lastLastIndex, match.index));
          // Fix browsers whose `exec` methods don't consistently return `undefined` for
          // nonparticipating capturing groups
          if (!compliantExecNpcg && match.length > 1) {
            match[0].replace(separator2, function () {
              for (var i = 1; i < arguments.length - 2; i++) {
                if (arguments[i] === undef) {
                  match[i] = undef;
                }
              }
            });
          }
          if (match.length > 1 && match.index < str.length) {
            Array.prototype.push.apply(output, match.slice(1));
          }
          lastLength = match[0].length;
          lastLastIndex = lastIndex;
          if (output.length >= limit) {
            break;
          }
        }
        if (separator.lastIndex === match.index) {
          separator.lastIndex++; // Avoid an infinite loop
        }
      }
      if (lastLastIndex === str.length) {
        if (lastLength || !separator.test("")) {
          output.push("");
        }
      } else {
        output.push(str.slice(lastLastIndex));
      }
      return output.length > limit ? output.slice(0, limit) : output;
    };

    return self;
  }();

  function startswith(string, prefix) {
    return string.substr(0, prefix.length) == prefix;
  }

  function endswith(string, suffix) {
    return string.substr(string.length - suffix.length, suffix.length) == suffix;
  }

  // http://stackoverflow.com/a/7924240/17498
  function occurrences(string, substring) {
    var n = 0;
    var pos = 0;
    while (true) {
      pos = string.indexOf(substring, pos);
      if (pos != -1) {
        n++;
        pos += substring.length;
      } else {
        break;
      }
    }
    return n;
  }

  var unquoted_percents_re = /%(?![0-9A-Fa-f]{2})/;

  // Quotes a URL if it isn't already quoted.
  function smart_urlquote(url) {
    // XXX: Not handling IDN.
    //
    // Convert protocol to lowercase.
    var colonIndex = url.indexOf(':');
    url = url.substring(0, colonIndex).toLowerCase() + url.substring(colonIndex);
    //
    // An URL is considered unquoted if it contains no % characters or
    // contains a % not followed by two hexadecimal digits.
    if (url.indexOf('%') == -1 || url.match(unquoted_percents_re)) {
      return encodeURI(url);
    } else {
      return url;
    }
  }

  var trailing_punctuation_django = ['.', ',', ':', ';'];
  var trailing_punctuation_improved = ['.', ',', ':', ';', '.)'];
  var wrapping_punctuation_django = [['(', ')'], ['<', '>'], ['<', '>']];
  var wrapping_punctuation_improved = [['(', ')'], ['<', '>'], ['<', '>'],
  				     ['“', '”'], ['‘', '’']];
  var word_split_re_django = /(\s+)/;
  var word_split_re_improved = /([\s<>"]+)/;
  var simple_url_re = /^https?:\/\/\w/i;

  var django_top_level_domains = ['com', 'edu', 'gov', 'int', 'mil', 'net', 'org'];
  var simple_email_re = /^\S+@\S+\.\S+$/;

  function htmlescape(html, options) {
    var escaped = html
      .replace(/&/g, "&")
      .replace(/</g, "<")
      .replace(/>/g, ">")
      .replace(/"/g, """)
      .replace(/'/g, "'");
    if (options && !options.django_compatible) { // only on django_compatible because => https://github.com/ljosa/urlize.js/pull/9
      escaped = escaped.replace(/\//g, "/");
    }
    return escaped;
  }

  function urlescape(url) {
    return url // Do not escape slash, because is used for the http:// part
      .replace(/&/g, "&")
      .replace(/</g, "<")
      .replace(/>/g, ">")
      .replace(/"/g, """);
  }

  function convert_arguments(args) {
    var options;
    if (args.length == 2 && typeof (args[1]) == 'object') {
      options = args[1];
    } else {
      options = {
        nofollow: args[1],
        autoescape: args[2],
        trim_url_limit: args[3],
        target: args[4]
      };
    }
    if (!('django_compatible' in options)) options.django_compatible = true;
    return options;
  }

  function urlize(text, options) {
    options = convert_arguments(arguments);

    function trim_url(x, limit) {
      if (options.trim === "http" || options.trim === "www")
        x = x.replace(/^https?:\/\//i, '');
      if (options.trim === "www")
        x = x.replace(/^www\./i, '');
      if (limit === undefined) limit = options.trim_url_limit;
      if (limit && x.length > limit) return x.substr(0, limit - 3) + '...';
      return x;
    }
    var safe_input = false;
    var word_split_re = options.django_compatible ? word_split_re_django : word_split_re_improved;
    var trailing_punctuation = options.django_compatible ? trailing_punctuation_django : trailing_punctuation_improved;
    var wrapping_punctuation = options.django_compatible ? wrapping_punctuation_django : wrapping_punctuation_improved;
    var simple_url_2_re = new RegExp('^www\\.|^(?!http)\\w[^@]+\\.(' +
                        (options.top_level_domains || django_top_level_domains).join('|') +
                        ')$',
                        "i");
    var words = split(text, word_split_re);
    for (var i = 0; i < words.length; i++) {
      var word = words[i];
      var match = undefined;
      if (word.indexOf('.') != -1 || word.indexOf('@') != -1 || word.indexOf(':') != -1) {
        // Deal with punctuation.
        var lead = '';
        var middle = word;
        var trail = '';
        for (var j = 0; j < trailing_punctuation.length; j++) {
          var punctuation = trailing_punctuation[j];
          if (endswith(middle, punctuation)) {
            middle = middle.substr(0, middle.length - punctuation.length);
            trail = punctuation + trail;
          }
        }
        for (var j = 0; j < wrapping_punctuation.length; j++) {
          var opening = wrapping_punctuation[j][0];
          var closing = wrapping_punctuation[j][1];
          if (startswith(middle, opening)) {
            middle = middle.substr(opening.length);
            lead = lead + opening;
          }
          // Keep parentheses at the end only if they're balanced.
          if (endswith(middle, closing) && occurrences(middle, closing) == occurrences(middle, opening) + 1) {
            middle = middle.substr(0, middle.length - closing.length);
            trail = closing + trail;
          }
        }

        // Make URL we want to point to.
        var url = undefined;
        var nofollow_attr = options.nofollow ? ' rel="nofollow"' : '';
        var target_attr = options.target ? ' target="' + options.target + '"' : '';

        if (middle.match(simple_url_re)) url = smart_urlquote(middle);
        else if (middle.match(simple_url_2_re)) url = smart_urlquote('http://' + middle);
        else if (middle.indexOf(':') == -1 && middle.match(simple_email_re)) {
          // XXX: Not handling IDN.
          url = 'mailto:' + middle;
          nofollow_attr = '';
        }

        // Make link.
        if (url) {
          var trimmed = trim_url(middle);
          if (options.autoescape) {
            // XXX: Assuming autoscape == false
            lead = htmlescape(lead, options);
            trail = htmlescape(trail, options);
            url = urlescape(url);
            trimmed = htmlescape(trimmed, options);
          }
          middle = '' + trimmed + '' +
                    ' ';
          words[i] = lead + middle + trail;
        } else {
          if (safe_input) {
            // Do nothing, as we have no mark_safe.
          } else if (options.autoescape) {
            words[i] = htmlescape(word, options);
          }
        }
      } else if (safe_input) {
        // Do nothing, as we have no mark_safe.
      } else if (options.autoescape) {
        words[i] = htmlescape(word, options);
      }
    }
    return words.join('');
  }

  urlize.test = {};
  urlize.test.split = split;
  urlize.test.convert_arguments = convert_arguments;

  return urlize;
})();
<|endoftext|>


<commit_before>/* istanbul ignore if */
if (typeof define !== "function") {
	var define = require("amdefine")(module);
}

define(function (require) {
	"use strict";

	/*meta({
		"name": "Array",
		"type": "class",
		"global": true
	})*/

	require("../class/method");
	require("./from");

	var meta = require("../meta");

	Array.method(
		meta({
			"name": "insertAt",
			"description": "Insert items into array",
			"arguments": [{
				"name": "index",
				"type": "number",
				"description": "Where to insert items"
			}, {
				"name": "item",
				"type": "any",
				"repeating": true,
				"description": "All additional arguments are inserted"
			}]
		}),
		insertAt
	);

	function insertAt () {
		var args = Array.from(arguments);

		// howMany = 0 into args so no items are removed
		args.splice(1, 0, 0);

		return this.splice.apply(this, args);
	}
});<commit_msg>adding more details to meta data description<commit_after>/* istanbul ignore if */
if (typeof define !== "function") {
	var define = require("amdefine")(module);
}

define(function (require) {
	"use strict";

	/*meta({
		"name": "Array",
		"type": "class",
		"global": true
	})*/

	require("../class/method");
	require("./from");

	var meta = require("../meta");

	Array.method(
		meta({
			"name": "insertAt",
			"description": "Insert items into array",
			"arguments": [{
				"name": "index",
				"type": "number",
				"description": "Where to insert items. Any number greater than array.length will be set to length. Negative number will insert from the end of array."
			}, {
				"name": "item",
				"type": "any",
				"repeating": true,
				"description": "All additional arguments are inserted"
			}]
		}),
		insertAt
	);

	function insertAt () {
		var args = Array.from(arguments);

		// howMany = 0 into args so no items are removed
		args.splice(1, 0, 0);

		return this.splice.apply(this, args);
	}
});<|endoftext|>


<commit_before>var fs = require('fs');
var mp4boxModule = require('mp4box');

if (process.argv.length < 3) {
	console.log("usage: node mp4codec.js <inputfilename>");
	return;
}

var mp4box = new mp4boxModule.MP4Box();
var stopParse = false;

mp4box.onReady = function (info) {
	var mime = 'video/mp4; codecs=\"';
	for (var i = 0; i < info.tracks.length; i++) {
		if (i != 0) mime += ',';
		mime+= info.tracks[i].codec;
	}
	mime += '\"';
	console.log(mime);
	stopParse = true;
}

var filePos = 0;
var filereader = fs.createReadStream(process.argv[2]);
filereader.on('readable', function () {
	if (stopParse) {
	} else {
		//console.log("Readable event");
		var chunk = filereader.read();
		//console.log("Read chunk", chunk);
		if (chunk) {
			var arrayBuffer = toArrayBuffer(chunk);
			//console.log("ArrayBuffer", arrayBuffer);
			arrayBuffer.fileStart = filePos;
			filePos += arrayBuffer.byteLength;
			mp4box.appendBuffer(arrayBuffer);
		} else {
			mp4box.flush();
		}
	}
});

function toArrayBuffer(buffer) {
    var ab = new ArrayBuffer(buffer.length);
    var view = new Uint8Array(ab);
    for (var i = 0; i < buffer.length; ++i) {
        view[i] = buffer[i];
    }
    return ab;
}
<commit_msg>fix lint warning in node example<commit_after>var fs = require('fs');
var mp4boxModule = require('mp4box');

if (process.argv.length < 3) {
	console.log("usage: node mp4codec.js <inputfilename>");
	return;
}

var mp4box = new mp4boxModule.MP4Box();
var stopParse = false;

mp4box.onReady = function (info) {
	var mime = 'video/mp4; codecs=\"';
	for (var i = 0; i < info.tracks.length; i++) {
		if (i !== 0) mime += ',';
		mime+= info.tracks[i].codec;
	}
	mime += '\"';
	console.log(mime);
	stopParse = true;
}

var filePos = 0;
var filereader = fs.createReadStream(process.argv[2]);
filereader.on('readable', function () {
	if (stopParse) {
	} else {
		//console.log("Readable event");
		var chunk = filereader.read();
		//console.log("Read chunk", chunk);
		if (chunk) {
			var arrayBuffer = toArrayBuffer(chunk);
			//console.log("ArrayBuffer", arrayBuffer);
			arrayBuffer.fileStart = filePos;
			filePos += arrayBuffer.byteLength;
			mp4box.appendBuffer(arrayBuffer);
		} else {
			mp4box.flush();
		}
	}
});

function toArrayBuffer(buffer) {
    var ab = new ArrayBuffer(buffer.length);
    var view = new Uint8Array(ab);
    for (var i = 0; i < buffer.length; ++i) {
        view[i] = buffer[i];
    }
    return ab;
}
<|endoftext|>


<commit_before>var skillsCollection = [
  {
    'name': 'Data Science',
    'percentage': '85'
  },
  {
    'name': 'Analytics (Predictive, Descriptive) ',
    'percentage': '90'
  },
  {
    'name': 'Machine Learning (Deep-Learning)',
    'percentage': '60'
  },
  {
    'name': 'Tensorflow, Tflearn,  ',
    'percentage': '80'
  },
  {
    'name': 'SQL(MySQL,DB2,Postgres)',
    'percentage': '80'
  },
  {
    'name': 'Python, R, SPSS',
    'percentage': '70'
  },
  {
    'name': 'Algorithms and Datastructures',
    'percentage': '80'
  },
  {
    'name': 'SPSS Modeler, SAS Enterprise Miner, Tableau',
    'percentage': '90'
  },
  {
    'name': 'AWS, Cloud Computing',
    'percentage': '65'
  },
  {
    'name': 'Distributed Computing, ',
    'percentage': '95'
  },
  {
    'name': 'SVN, GIT',
    'percentage': '80'
  }
];

function data() {
  return skillsCollection;
}<commit_msg>changed dataservice added extra skill<commit_after>var skillsCollection = [
  {
    'name': 'Data Science',
    'percentage': '85'
  },
  {
    'name': 'Analytics (Predictive, Descriptive) ',
    'percentage': '90'
  },
  {
    'name': 'Machine Learning (Deep-Learning)',
    'percentage': '70'
  },
  {
    'name': 'Tensorflow, Tflearn,  ',
    'percentage': '80'
  },
  {
    'name': 'SQL(MySQL,DB2,Postgres)',
    'percentage': '80'
  },
  {
    'name': 'R, Python (Numpy, Scikit, Pandas)  ',
    'percentage': '80'
  },
  {
    'name': 'Algorithms and Datastructures',
    'percentage': '80'
  },
  {
    'name': 'SPSS Modeler, SAS Enterprise Miner, Tableau',
    'percentage': '90'
  },
  {
    'name': 'Protractor, Jasmine',
    'percentage': '65'
  },
  {
    'name': 'Lodash, Underscore',
    'percentage': '95'
  },
  {
    'name': 'SVN, GIT',
    'percentage': '80'
  },
  {
    'name': 'SPSS, SAS, Excel',
    'percentage': '70'
  }

];

function data() {
  return skillsCollection;
}<|endoftext|>


<commit_before>var path = require('path');

var temp = process.env.TMPDIR
 || process.env.TMP
 || process.env.TEMP
 || process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp';

var home = (process.platform === 'win32'
  ? process.env.USERPROFILE
  : process.env.HOME) || temp;

var cache = process.platform === 'win32'
  ? path.resolve(process.env.APPDATA || home || temp, 'bower-cache')
  : path.resolve(home || temp, '.bower');

// Bower Config
module.exports = require('rc') ('bower', {
    cache      :  cache,
    json       : 'component.json',
    endpoint   : 'https://bower.herokuapp.com',
    directory  : 'components'
});<commit_msg>Also use local .bowerrc file.<commit_after>var path = require('path');
var fs   = require('fs');
var _    = require('lodash');

var temp = process.env.TMPDIR
 || process.env.TMP
 || process.env.TEMP
 || process.platform === 'win32' ? 'c:\\windows\\temp' : '/tmp';

var home = (process.platform === 'win32'
  ? process.env.USERPROFILE
  : process.env.HOME) || temp;

var cache = process.platform === 'win32'
  ? path.resolve(process.env.APPDATA || home || temp, 'bower-cache')
  : path.resolve(home || temp, '.bower');

// Bower Config
var config = require('rc') ('bower', {
    cache      :  cache,
    json       : 'component.json',
    endpoint   : 'https://bower.herokuapp.com',
    directory  : 'components'
});

// If there is a local .bowerrc file, merge it
var localFile = path.join(this.cwd, '.bowerrc');
if (fs.existsSync(localFile)) {
    _.extend(config, JSON.parse(fs.readFileSync(localFile)));
}

module.exports = config;<|endoftext|>