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

Brian Newsom Week 4 #19

Open
wants to merge 5 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
48 changes: 27 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
# Name

write-your-name
Brian Newsom

# How many points have you earned?

0/100

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

# How many hours have you spent on this?

fill-in-your-answer
7

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

fill-in-your-answer
Getting started with Restler.. I couldn't find a lot of documentation on how to get a simple query going.

# Show and tell

## Link (3 points)

[title-of-the-article](http://link-to-an-interesting-article-about-the-notion-of-quantified-self)
[What I've Learned From Two Years Of Wearables](http://www.pocketgamer.biz/comment-and-opinion/59882/what-ive-learned-from-two-years-of-wearables/)

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

I found this article interesting. It specifically applies to fitness wearables that collect data about workouts, which I've always been interested in but never pursued. I think the point of the article can be summed up in the following:
```
As I stress, though, it's not the data that forces the change.

The more data you get, the less significant it become. What's key is that you are prepared to modify your behaviour.
```

I believe people like the idea of buying something that will make them change their life through data, but truly that motivation must come from one's self, as data becomes insignificant without any heart behind it.
fill-in-your-answer

# API (II) (5 points x 4 + 8 points x 2 = 36 points)
Expand All @@ -43,7 +49,7 @@ fill-in-your-answer
### 3 (4 points)

* Code: [github3.js](github3.js)
* Result: [result3.json](result.json)
* Result: [result3.json](result3.json)

### 4 (4 points)

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

### 1 (4 points)

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

### 2 (4 points)

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

### 3 (4 points)

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

### 4 (4 points)

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

### 5 (4 points)

![image](image.png?raw=true)
![image](orcp5.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)

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

### 7 (4 points)

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

### 8 (10 points)

![image](image.png?raw=true)
![image](challenge8.png?raw=true)
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 challenge6.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 challenge7.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 challenge8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 13 additions & 1 deletion github1.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// TODO:
// Brian Newsom
// Challenge 1: Get some repos.
var rest = require('restler');

rest.get('https://api.github.com/repositories').on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
14 changes: 13 additions & 1 deletion github2.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// TODO:
// Brian Newsom
// Challenge 2: Get course repos.
var rest = require('restler');

rest.get('https://api.github.com/orgs/csci-4830-002-2014/repos').on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
15 changes: 14 additions & 1 deletion github3.js
Original file line number Diff line number Diff line change
@@ -1 +1,14 @@
// TODO:
// Brian Newsom
// Challenge 3: Get forks from week 1 Challenge

var rest = require('restler');

rest.get('https://api.github.com/repos/csci-4830-002-2014/challenge-week-1/forks').on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
14 changes: 13 additions & 1 deletion github4.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// TODO:
// Brian Newsom
// Challenge 4: Get CLOSED pull requests from challenge week 1
var rest = require('restler');
var request = "?state=closed";
rest.get('https://api.github.com/repos/csci-4830-002-2014/challenge-week-1/pulls' + request).on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
14 changes: 13 additions & 1 deletion github5.js
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
// TODO:
// Brian Newsom
// Get contributors list
var rest = require('restler');

rest.get('https://api.github.com/repos/peymanmortazavi/hackathon-accesslog/stats/contributors').on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
22 changes: 21 additions & 1 deletion github6.js
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
// TODO:
// Brian Newsom
// Challenge 6: Create issue from restler node.

var rest = require('restler');
var data = {
'title': 'Challenge 6',
'body': 'I ate breakfast this time.'
};
var options = {
username: 'BrianNewsom',
password: '<PASSWORD>'
};
rest.postJson('https://api.github.com/repos/CSCI-4830-002-2014/challenge-week-4/issues', data,options).on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
31 changes: 30 additions & 1 deletion github7.js
Original file line number Diff line number Diff line change
@@ -1 +1,30 @@
// TODO:
// Brian Newsom
// Challenge 7: Use similar methodology to hackathon to get 10 pages of course events.

var rest = require("restler");
var async = require("async");

function getEvents(i, callback) {
var page = "?page=" + i;
rest.get('https://api.github.com/orgs/CSCI-4830-002-2014/events' + page).on('complete', function(res) {
if (res instanceof Error) {
console.log('Error: ', res.message);
this.retry(1000);
}
else {
console.log(res);
}
});
};

// [ [a,a,a], [b,b,b], ... ] -> [a,a,a,b,b,b, ... ]
function flatten_slow(input){
return input.reduce(function(a, b) {
return a.concat(b);
}, []);
}

async.map([1,2,3,4,5,6,7,8,9,10], getEvents, function(err, results){
flattened = flatten_slow(results);
console.log(JSON.stringify(flattened, undefined, 4));
});
Binary file added orcp1.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 orcp2.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 orcp3.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 orcp4.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 orcp5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading