Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Samer Buna
    @samerbuna
    lol
    i use 2 accounts
    the other account is "edgecoder"
    Cade Nichols
    @cadenichols
    'use strict';
    
    function decimalToBinary(number){
      var binaryString = '';
      do{
        if(number % 2){
          binaryString = ('1'.concat(binaryString));    
          number = (number - 1) / 2;
        }else{
          binaryString = '0'.concat(binaryString);
          number = number / 2;
        }
      }while (number > 0);
      return parseInt(binaryString);
    }
    
    for(var i=0; i <= 32; i ++){
      console.log(decimalToBinary(i));
    }
    Cade Nichols
    @cadenichols
    function decimalToBinary(number){
      return number.toString(2);
    }
    
    for(var i=0; i <= 32; i ++){
      console.log(decimalToBinary(i));
    }
    tania
    @tania531
    var profiles = [{un:'samerbuna', dailyCommits:3, name:"Samer Buna", avatar_url:"https://avatars.githubusercontent.com/u/75209?v=3"},
    {un:'dhh', dailyCommits:2, name:"Daniel", avatar_url:"https://avatars.githubusercontent.com/u/2741?v=3"},
    {un:'tania531', dailyCommits:7, name:"Tania", avatar_url:"https://avatars.githubusercontent.com/u/709654?v=3"}];
    
    function generateTiles() {
      profiles.forEach(function(profile){
        var url = 'https://api.github.com/users/'+profile.un;
        // debugger;
        // console.log(response);
        $.getJSON(url, function(response){
          console.log(response);
    
          var $newRow = $("#template").clone();
          $newRow.find(".card.row").css('background-color',colorTiles(profile.dailyCommits));
          $newRow.find(".image").attr("src", profile.avatar_url);
          $newRow.find(".name").text(response.name);
          console.log(response.name);
          $newRow.find(".dailyCommits").text(profile.dailyCommits);
          $newRow.removeClass("hidden");
          $('#cards-container').append($newRow);
        });
      });
    }
    
    function colorTiles(dc){
      return dc > 4 ? 'green' : 'red';
    
    }
    js above
    jade section below
    body
        .container
          .panel.panel-default
            .panel.body
              #github
              h1 Git Blame
              #ch
    
          #cards-container.row
            #template.col-sm-4.hidden
              .card.row
                .col-sm-4.left-edge-content
                  img.image(src='')
                .col-sm-8
                  .name
                .col-sm-8
                  .dailyCommits
    Cade Nichols
    @cadenichols
    Cade Nichols
    @cadenichols
    Chris Oyler
    @IAmEddieDean
    
    var doiArr = text.toLowerCase().match(/[a-z']+/gi);
    //var theCounter = 0;
    var counts = {};
    doiArr.forEach(function(word){
        counts[word] = counts[word] || 0;
        counts[word]++;
    
    });
    var results = []
    
    function toCamelCase(word){
      var wordArr = word.split('-');
      wordArr.forEach(function(word, index){
        if(index === 0) {
          results.push(word.toLowerCase());
        }else{
          results.push(word.toLowerCase().word[0].toUpperCase());
        }
      });
    }
    Chris Oyler
    @IAmEddieDean
    YO!! We need you folks in the pit so we can finish this website tonight. Samer’s directive.
    Edwin Dover
    @Edsdover
    Samer Blammer! You down for a quick Q&A?

    Samer!

    Samer Buna
    @samerbuna
    look at you marking down
    Edwin Dover
    @Edsdover
    ・::・(/////∇/////)・::・
    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
    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
    Very doable. I only ask because, as a user, I find the information is a bit diluted.
    Thanks for your time!
    Samer Buna
    @samerbuna
    The quality of the algorithm is part of the quality of your code
    Chris Oyler
    @IAmEddieDean
    @Edsdover would you make a commit/push?
    Edwin Dover
    @Edsdover
    +function countComments(eventsresponse){
    +  var commentCount = 0;
    +  eventsresponse.forEach(function(event){
    +    if(event.type.match(/(comment)/gi)){
    +      commentCount++;
    +    }
    +  });
    +  return commentCount;
    +}
    Edwin Dover
    @Edsdover
    <span class="octicon octicon-git-pull-request"></span>
    Chris Oyler
    @IAmEddieDean
    Chris Oyler
    @IAmEddieDean
    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
    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
    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
    This message was deleted
    Edwin Dover
    @Edsdover
    Here is the link to the published site. http://gitblame.edwindover.com/
    tania
    @tania531
    ok, nm @samerbuna , problem solved - on to next :)
    tania
    @tania531
    hey samer - Im a little stuck on the 'get one' - I'm working on that first - here is what I'm trying to do based on the examples you found
    // GET ONE
    
    server.route({
      method: 'GET',
      path: '/tasks/' + task._id,
      handler: function (request, reply) {
        var task = new Task();
    
        task.find({}, function(err, task) {
            if (!err) {
                reply(task);
            } else {
                reply(Boom.badImplementation(err)); // 500 error
            }
        });
      }
    });
    so the main error is that 'task' isn't defined - which it isn't yet in the =3rd line
    sorry to be lame but I am not sure how to construct this
    tania
    @tania531
    I see that task id has to be in { } now for example
    Chris Oyler
    @IAmEddieDean
    path: '/dogs/{dogId}'
    this is an example from our work today of what that looks like, though I’m sure you have that by now
    Samer Buna
    @samerbuna
    @tania531 you should be using findOne for this
    tania
    @tania531
    ok yes
    Emile just helped me work through the approximately 10 wrong things in that snippet I sent you!
    He also refused to just point it out - he made me get there haha!
    thank you
    now I'm working on delete!