<commit_before>angular.module('coderace.factories', [])

.factory('socket', function ($rootScope) {
  var socket = io.connect();

  var factory = {};

  factory.on = function (eventName, callback) {
    socket.on(eventName, function () {  
      var args = arguments;
      $rootScope.$apply(function () {
        callback.apply(socket, args);
      });
    });
  };

  factory.emit = function (eventName, data, callback) {
    socket.emit(eventName, data, function () {
      var args = arguments;
      $rootScope.$apply(function () {
        if (callback) {
          callback.apply(socket, args);
        }
      });
    });
  };

  factory.disconnect = function(){
    socket.disconnect();
  };

  factory.connect = function(){
    socket.connect();
  };

  return factory;
})

.factory('Race', function ($rootScope) {
  var factory = {};
  
  factory.username;

  factory.dataRef = new Firebase("https://popping-heat-272.firebaseio.com/");

  /*  called by slave user  */
  factory.setProblem = function(data){
    $rootScope.problem = data;
    $rootScope.$broadcast('Race:ready', $rootScope.problem);
  };

  /*  called by master user, call to Firebase to get problem  */
  factory.getData = function(index, callback){
    factory.dataRef.child("Challenges").child(index).on("value", function(snapshot) {
      var problem = snapshot.val();
      $rootScope.$broadcast('Race:ready', problem);
      callback(problem);// send slave the problem
    });
  };

  factory.getLength = function(){
    factory.dataRef.child("Challenges").on("value", function(snapshot) {
      var challenges = snapshot.val();
      $rootScope.$broadcast('GotLength');
    });
  };

  return factory;

});
<commit_msg>[fix] Change firebase url<commit_after>angular.module('coderace.factories', [])

.factory('socket', function ($rootScope) {
  var socket = io.connect();

  var factory = {};

  factory.on = function (eventName, callback) {
    socket.on(eventName, function () {  
      var args = arguments;
      $rootScope.$apply(function () {
        callback.apply(socket, args);
      });
    });
  };

  factory.emit = function (eventName, data, callback) {
    socket.emit(eventName, data, function () {
      var args = arguments;
      $rootScope.$apply(function () {
        if (callback) {
          callback.apply(socket, args);
        }
      });
    });
  };

  factory.disconnect = function(){
    socket.disconnect();
  };

  factory.connect = function(){
    socket.connect();
  };

  return factory;
})

.factory('Race', function ($rootScope) {
  var factory = {};

  factory.username;

  factory.dataRef = new Firebase("https://codefighter.firebaseio.com/");

  /*  called by slave user  */
  factory.setProblem = function(data){
    $rootScope.problem = data;
    $rootScope.$broadcast('Race:ready', $rootScope.problem);
  };

  /*  called by master user, call to Firebase to get problem  */
  factory.getData = function(index, callback){
    factory.dataRef.child("Challenges").child(index).on("value", function(snapshot) {
      var problem = snapshot.val();
      $rootScope.$broadcast('Race:ready', problem);
      callback(problem);// send slave the problem
    });
  };

  factory.getLength = function(){
    factory.dataRef.child("Challenges").on("value", function(snapshot) {
      var challenges = snapshot.val();
      $rootScope.$broadcast('GotLength');
    });
  };

  return factory;

});

{'fraction_non_alphanumeric': 0.16427104722792607, 'fraction_numerical': 0.0008800234672924611, 'mean_word_length': 3.0692124105011933, 'pattern_counts': {'":': 0, '<': 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': '6481195', 'n_tokens_mistral': 1057, 'n_tokens_neox': 1020, 'n_words': 201}