<commit_before>function timestamp() {
  return Date.now();
}

function log(message) {
  console.log(timestamp() + ": " + message);
}

// TODO: Notify when we notice that streams went live.
// TODO: Update the browser action icon via
//         chrome.browserAction.setIcon({"path": "img/icon.png"});
function notify() {
  chrome.notifications.create("bla", {
    "type": "basic", "iconUrl": "img/icon.svg", "title": "remove channel",
    "message": channel
  });
}

function Channel(name) {
  this.name = name;
  this.viewers = 0;
  this.isLive = false;
}

Channel.prototype = {
  pollState: function() {
    return $.ajax({
      "url": "https://api.twitch.tv/kraken/streams/" + this.name,
      "dataType": "json"
    }).done(function(data) {
      var stream = data.stream;
      if (stream) {
        this.viewers = stream.viewers;
        this.isLive = true;
      } else {
        this.viewers = 0;
        this.isLive = false;
      }
    }.bind(this));
  }
}

function Channels() {
  this.channelList_ = [];
  this.onchangeCallback_ = null;
}

Channels.prototype = {
  count: function() {
    return this.channelList_.length;
  },

  find_: function(name) {
    for (var idx in this.channelList_) {
      if (this.channelList_[idx].name === name) {
        return idx;
      }
    }
    return -1;
  },

  get_: function(name) {
    var idx = this.find_(name);
    if (idx !== -1) {
      return this.channelList_[idx];
    }
    return null;
  },

  addChannel: function(name) {
    if (name && this.find_(name) === -1) {
      this.channelList_.push(new Channel(name));
      this.save_();
      return true;
    }
    return false;
  },

  removeChannel: function(name) {
    var idx = this.find_(name);
    if (idx !== -1) {
      this.channelList_.splice(idx, 1);
      this.save_();
    }
  },

  getChannelNames_: function() {<commit_msg>Prepend new channels to the channel list<commit_after>function timestamp() {
  return Date.now();
}

function log(message) {
  console.log(timestamp() + ": " + message);
}

// TODO: Notify when we notice that streams went live.
// TODO: Update the browser action icon via
//         chrome.browserAction.setIcon({"path": "img/icon.png"});
function notify() {
  chrome.notifications.create("bla", {
    "type": "basic", "iconUrl": "img/icon.svg", "title": "remove channel",
    "message": channel
  });
}

function Channel(name) {
  this.name = name;
  this.viewers = 0;
  this.isLive = false;
}

Channel.prototype = {
  pollState: function() {
    return $.ajax({
      "url": "https://api.twitch.tv/kraken/streams/" + this.name,
      "dataType": "json"
    }).done(function(data) {
      var stream = data.stream;
      if (stream) {
        this.viewers = stream.viewers;
        this.isLive = true;
      } else {
        this.viewers = 0;
        this.isLive = false;
      }
    }.bind(this));
  }
}

function Channels() {
  this.channelList_ = [];
  this.onchangeCallback_ = null;
}

Channels.prototype = {
  count: function() {
    return this.channelList_.length;
  },

  find_: function(name) {
    for (var idx in this.channelList_) {
      if (this.channelList_[idx].name === name) {
        return idx;
      }
    }
    return -1;
  },

  get_: function(name) {
    var idx = this.find_(name);
    if (idx !== -1) {
      return this.channelList_[idx];
    }
    return null;
  },

  addChannel: function(name) {
    if (name && this.find_(name) === -1) {
      this.channelList_.unshift(new Channel(name));
      this.save_();
      return true;
    }
    return false;
  },

  removeChannel: function(name) {
    var idx = this.find_(name);
    if (idx !== -1) {
      this.channelList_.splice(idx, 1);
      this.save_();
    }
  },

  getChannelNames_: function() {
{'fraction_non_alphanumeric': 0.16381156316916487, 'fraction_numerical': 0.003747323340471092, 'mean_word_length': 2.522148916116871, 'pattern_counts': {'":': 16, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7413649', 'n_tokens_mistral': 1279, 'n_tokens_neox': 1248, 'n_words': 274}