Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finished week 4 challenge #46

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/*
32 changes: 16 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
# Name

write-your-name
Jake Charland

# How many points have you earned?

0/100
100/100

(Make your own calculation and replace the number 0 with the points you think you've earned.)

# How many hours have you spent on this?

fill-in-your-answer
4

# What is the most difficult part about this week's challenge?

fill-in-your-answer
The restler documentation was very poor so it took awhile to get started.

# Show and tell

## Link (3 points)

[title-of-the-article](http://link-to-an-interesting-article-about-the-notion-of-quantified-self)
[what are we reading](http://quantifiedself.com/2014/09/reading-29/)

## How do you relate to this article personally? (3 points)

fill-in-your-answer
It relates back to working out and time spent doing a sport which relates very well to me as I spend a lot of my time rock climbing.

# API (II) (5 points x 4 + 8 points x 2 = 36 points)

Expand Down Expand Up @@ -72,45 +72,45 @@ fill-in-your-answer

### 1 (4 points)

![image](image.png?raw=true)
![image](cp1.png?raw=true)

### 2 (4 points)

![image](image.png?raw=true)
![image](cp2.png?raw=true)

### 3 (4 points)

![image](image.png?raw=true)
![image](cp3.png?raw=true)

### 4 (4 points)

![image](image.png?raw=true)
![image](cp4.png?raw=true)

### 5 (4 points)

![image](image.png?raw=true)
![image](cp5.png?raw=true)

## Challenges (4 points x 7 + 10 points x 1 = 38 points)

### 1 (4 points)

![image](image.png?raw=true)
![image](challenge1.png?raw=true)

### 2 (4 points)

![image](image.png?raw=true)
![image](challenge2.png?raw=true)

### 3 (4 points)

![image](image.png?raw=true)
![image](challenge3.png?raw=true)

### 4 (4 points)

![image](image.png?raw=true)
![image](challenge4.png?raw=true)

### 5 (4 points)

![image](image.png?raw=true)
![image](challenge5.png?raw=true)

### 6 (4 points)

Expand Down
Binary file added challenge1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added challenge2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added challenge3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added challenge4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added challenge5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cp2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cp3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cp4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added cp5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 12 additions & 1 deletion github1.js
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
// TODO:
var restler = require('restler');

restler.get('https://api.github.com/repositories').on('complete', function(publicRepos) {
if (publicRepos instanceof Error) {
console.log('Error:', publicRepos.message);
this.retry(500);
}
else {
console.log(publicRepos);
}
});

12 changes: 11 additions & 1 deletion github2.js
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
// TODO:
var restler = require('restler');

restler.get('https://api.github.com/orgs/CSCI-4830-002-2014/repos').on('complete', function(classRepos) {
if (classRepos instanceof Error) {
console.log('Error:', classRepos.message);
this.retry(500);
}
else {
console.log(classRepos);
}
});
12 changes: 11 additions & 1 deletion github3.js
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
// TODO:
var restler = require('restler');

restler.get('https://api.github.com/repos/CSCI-4830-002-2014/challenge-week-1/forks').on('complete', function(forks) {
if (forks instanceof Error) {
console.log('Error:', forks.message);
this.retry(500);
}
else {
console.log(forks);
}
});
14 changes: 13 additions & 1 deletion github4.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// TODO:
var restler = require('restler');
var request = "state=closed"

restler.get('https://api.github.com/repos/CSCI-4830-002-2014/challenge-week-1/pulls?' + request ).on('complete', function(closedPulls) {
if (closedPulls instanceof Error) {
console.log('Error:', closedPulls.message);
this.retry(500);
}
else {
console.log(closedPulls);
}
});

12 changes: 11 additions & 1 deletion github5.js
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
// TODO:
var restler = require('restler');

restler.get('https://api.github.com/repos/nikitavoskoboynik/hackathon-accesslog/stats/contributors' ).on('complete', function(contribute) {
if (contribute instanceof Error) {
console.log('Error:', contribute.message);
this.retry(500);
}
else {
console.log(contribute);
}
});
18 changes: 17 additions & 1 deletion github6.js
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
// TODO:
var restler = require('restler');
var data = {
"title": "Week 4 reslter issue"
}
var options = {
"username": "jakecharland",
"password": "PUT PASSWORD HERE"
}
restler.postJson('https://api.github.com/repos/CSCI-4830-002-2014/challenge-week-4/issues', data, options).on('complete', function(issueResult) {
if (issueResult instanceof Error) {
console.log('Error:', issueResult.message);
this.retry(1500);
}
else {
console.log(issueResult);
}
});
28 changes: 27 additions & 1 deletion github7.js
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
// TODO:
var GitHubApi = require("github");
var async = require("async");

var github = new GitHubApi({
version: "3.0.0",
timeout: 5000
});

function getClassEventsForPage(i, callback){
github.repos.getFromOrg({
org:"CSCI-4830-002-2014",
page: i
}, callback);
};

// [ [a,a,a], [b,b,b], ... ] -> [a,a,a,b,b,b, ... ]
function flatten_fast(input){
return input.reduce(function(a, b) {
return a.concat(b);
}, []);
}
async.map([1,2,3,10], getClassEventsForPage, function(err, results){

flattened = flatten_fast(results);

console.log(JSON.stringify(flattened, undefined, 10));
});
Loading