These are chat archives for apr15/apr15chat

17th
Apr 2015
tania
@tania531
Apr 17 2015 00:49
var profiles = [{un:'samerbuna', dailyCommits:3},{un:'dhh', dailyCommits:2}]
Chris Oyler
@IAmEddieDean
Apr 17 2015 03:52
'use strict';

$(document).ready(init);

function init() {
  generateTiles();
}

//var gitIds = ['samerbuna', 'IAmEddieDean', 'dhh', 'ojangali'];
//var eventCount = [];
var profiles = [
  {un:'samerbuna', dailyCommits:3},
  // {un:'dhh', dailyCommits:2},
  // {un:'IAmEddieDean', dailyCommits:0, eventUrl:''},
  // {un:'EdsDover', dailyCommits:0, eventUrl:''},
  // {un:'chyld', dailyCommits:0, eventUrl:''},
];
function generateTiles() {
  profiles.forEach(function(profile){
    var url = 'https://api.github.com/users/'+profile.un;
    $.getJSON(url, function(response){
      var $newRow = $("#template").clone();
      $newRow.find(".image").attr("src", response.avatar_url);
      $newRow.find(".name").text(response.name);
      $newRow.removeClass("hidden");
      $('#cards-container').append($newRow);
      countCommits(response.events_url.replace('{/privacy}', ''));
      // console.log(response.events_url.replace('{/privacy}', ''));
    });
  });
}
function countCommits(events){
  var timeStamps = []
  $.getJSON(events, function(response){
    response.forEach(function(event){
      if (event.message !== ''){
        timeStamps.push(event.created_at);
        console.log(timeStamps);

      }
      // event.message ? timeStamps.push(event.created_at) : null;
      console.log(timeStamps.length);
    });
  });
}
doctype html
html
  head
    meta(charset='utf-8')
    meta(name="viewport", content="width=device-width, initial-scale=1")
    meta(http-equiv="X-UA-Compatible", content="IE=edge")
    title Git Blame
    link(rel='stylesheet', href='/vendor/bootstrap/dist/css/bootstrap.min.css')
    link(rel='stylesheet', href='/vendor/font-awesome/css/font-awesome.min.css')
    link(rel='stylesheet', href=isProd ? '/index.min.css' : '/index.css')
    link(rel='shortcut icon', href='/favicon.ico')
  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
    script(src='/vendor/moment/moment.js')
    script(src='/vendor/jquery/dist/jquery.min.js')
    script(src='/vendor/bootstrap/dist/js/bootstrap.min.js')
    script(src='/vendor/lodash/lodash.min.js')
    script(src=isProd ? '/index.min.js' : '/index.js')
Cade Nichols
@cadenichols
Apr 17 2015 04:24
moment.utc('2015-01-20T17:47:20Z').diff(moment.utc(), 'hours')
Chris Oyler
@IAmEddieDean
Apr 17 2015 04:54
@samerbuna ! Are you still awake?
Samer Buna
@samerbuna
Apr 17 2015 04:55
hellz yeah
Chris Oyler
@IAmEddieDean
Apr 17 2015 04:56
you never fail to entertain
question: you made commits today, correct? I’m pretty sure I watched you do it
the github ui and the github api are giving me different values, and that’s not cool man
Samer Buna
@samerbuna
Apr 17 2015 04:57
elaborate
Chris Oyler
@IAmEddieDean
Apr 17 2015 04:59
the api is saying you made two commits in the past 24 hours, the ui is saying you’ve made zero
and now we’re digging deeper and maybe you haven’t made a commit in a month?
wth, now i’m confused as all hell
Samer Buna
@samerbuna
Apr 17 2015 05:02
lol
i use 2 accounts
the other account is "edgecoder"
Cade Nichols
@cadenichols
Apr 17 2015 20:01
'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
Apr 17 2015 20:27
function decimalToBinary(number){
  return number.toString(2);
}

for(var i=0; i <= 32; i ++){
  console.log(decimalToBinary(i));
}
tania
@tania531
Apr 17 2015 20:32
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
Chris Oyler
@IAmEddieDean
Apr 17 2015 23:31

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());
    }
  });
}