These are chat archives for apr15/apr15chat

18th
Apr 2015
Chris Oyler
@IAmEddieDean
Apr 18 2015 03:09
YO!! We need you folks in the pit so we can finish this website tonight. Samer’s directive.
Edwin Dover
@Edsdover
Apr 18 2015 03:32
Samer Blammer! You down for a quick Q&A?

Samer!

Samer Buna
@samerbuna
Apr 18 2015 03:36
look at you marking down
Edwin Dover
@Edsdover
Apr 18 2015 03:37
・::・(/////∇/////)・::・
Thanks Samer! I want to ask you about the comments.
I can easily see how many have been made, but it is impossible to see if they were of any value.
If we are really making an app worth anything, including comments in the points would be silly.
for example, my "Edsdover commented 5 hours ago
OOHHH YEAAAAA" is worth nothing. But it would be counted.
So for the sake of a decent product I think they should be counted and displayed but not part of the green/red status formula
Thoughts?
Samer Buna
@samerbuna
Apr 18 2015 03:40
Good point, but why not make it count less, so a comment would give you 1 point, while a commit gives you 10, and a pull request gives you 15
something like that
Edwin Dover
@Edsdover
Apr 18 2015 03:42
Very doable. I only ask because, as a user, I find the information is a bit diluted.
Thanks for your time!
Samer Buna
@samerbuna
Apr 18 2015 03:44
The quality of the algorithm is part of the quality of your code
Chris Oyler
@IAmEddieDean
Apr 18 2015 04:29
@Edsdover would you make a commit/push?
Edwin Dover
@Edsdover
Apr 18 2015 05:54
+function countComments(eventsresponse){
+  var commentCount = 0;
+  eventsresponse.forEach(function(event){
+    if(event.type.match(/(comment)/gi)){
+      commentCount++;
+    }
+  });
+  return commentCount;
+}
Edwin Dover
@Edsdover
Apr 18 2015 07:21
<span class="octicon octicon-git-pull-request"></span>
Chris Oyler
@IAmEddieDean
Apr 18 2015 17:51
var text = "the cat jumpp";

var textArr = text.toLowerCase().match(/[a-z']+/gi);

var counts = {};

function maxCounter(arr){
arr.forEach(function(word){
  //counts[word] = (counts[word] || 0)+1;
  var letterCount= {};
  var letters = word.split('');
  letters.forEach(function(letter){
    letterCount[letter] = (letterCount[letter] || 0) +1;
    });
//   letterCount.forEach(function(count){
    console.log(letterCount);
//   })
  });
}
Samer Buna
@samerbuna
Apr 18 2015 18:39
function wordSelector(text){

  var textArr = text.toLowerCase().match(/[a-z']+/gi);
  var maxLetters = [];

  textArr.forEach(function(word){
    var letterCount = {};
    var letters = word.split('');
    letters.forEach(function(letter){
      letterCount[letter] = (letterCount[letter] || 0) +1;
    });
    console.log(word, letterCount.maxValue());
    maxLetters.push(letterCount.maxValue());
  });
  console.log(maxLetters.max());
}


Array.prototype.max = function() {
  return Math.max.apply(null, this);
}

function maxValueInObject(obj) {
  var max;

  // for (var prop in obj) {
  //   if (!max) {
  //     max = obj[prop];
  //   } else if (obj[prop] > max) {
  //     max = obj[prop];
  //   }
  // }
  //console.log(obj);

  var keys = Object.keys(obj);
  //console.log(keys);

  var values = keys.map(function(key){
    return obj[key];
  })

  // max = Math.max.apply(null, values);

  max = values.max();

  return max;
}


Object.prototype.maxValue = function() {
  return maxValueInObject(this);
}








var result = wordSelector("I attribute my success to this: I never gave or took any excuse. –Florence Nightingale");

console.log(result);

console.assert(maxValueInObject({a: 4, b:7, c:3, d: 1}) === 7);

console.assert(maxValueInObject({r: -1, c:2, y:5, z: 0}) === 5);
Cade Nichols
@cadenichols
Apr 18 2015 19:10
console.assert(JSON.stringify(  yourFunction(5)  ) === JSON.stringify({‘0’: 0, ‘1’, 10, ‘2’, 20, ‘3’, 30, ‘4’, 40}));
console.assert(JSON.stringify(  yourFunction(3)  ) === JSON.stringify({‘0’: 0, ‘1’, 10, ‘2’, 20}));
Cade Nichols
@cadenichols
Apr 18 2015 19:17
This message was deleted