<commit_before>// usage:
// window.addEvent("domready", function() {
//  new MooGitHub({username: 'botanicus', element: 'github-badge'});
// });

MooGitHub = new Class({
  Implements: Options,

  repos: [],

  options: {
    element: 'github-badge',
    max_items: 6,
    username: 'hotovson',
    url: 'http://github.com/api/v2/json/repos/show/',
  },

  initialize: function(options){
    this.setOptions(options);
    this.options.url = this.options.url + this.options.username;
    this.requestData();
  },

  requestData: function(){
    new Request.JSONP({
      element: this.options.element,
      url: this.options.url,
      items: this.options.max_items,

      onComplete: function(data){
        data.repositories.length < this.options.items ? slug = data.repositories.length : slug = this.options.items;
        this.repos = data.repositories.reverse().splice(1, slug);
        ul = new Element('ul');
        this.repos.each(function(repo){
          li = new Element('li');
          new Element('a', {
            text: repo.name,<commit_msg>List owned repositories sorted by last activity.<commit_after>// usage:
// window.addEvent("domready", function() {
//  new MooGitHub({username: 'botanicus', element: 'github-badge'});
// });

MooGitHub = new Class({
  Implements: Options,

  repos: [],

  options: {
    element: 'github-badge',
    max_items: 6,
    username: 'hotovson',
    url: 'http://github.com/api/v2/json/repos/show/',
  },

  initialize: function(options){
    this.setOptions(options);
    this.options.url = this.options.url + this.options.username;
    this.requestData();
  },

  requestData: function(){
    new Request.JSONP({
      element: this.options.element,
      url: this.options.url,
      items: this.options.max_items,

      onComplete: function(data){
        data.repositories.length < this.options.items ? slug = data.repositories.length : slug = this.options.items;

        this.repos = data.repositories.filter(
          function(item, index){
            return !item.fork;
          }).sort(
          function(a,b){
            if (b.pushed_at > a.pushed_at) return 1;
            if (b.pushed_at < a.pushed_at) return -1;
            return 0;
          }).splice(0, slug);

        ul = new Element('ul');
        this.repos.each(function(repo){
          li = new Element('li');
          new Element('a', {
            text: repo.name,
{'fraction_non_alphanumeric': 0.15522263836870578, 'fraction_numerical': 0.003745318352059925, 'mean_word_length': 2.5667655786350148, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, 'https://': 0, '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': '2816335', 'n_tokens_mistral': 796, 'n_tokens_neox': 752, 'n_words': 150}