Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Simone Marzulli committed Jan 31, 2022
1 parent e227818 commit 02ea1d2
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
48 changes: 24 additions & 24 deletions lib/Github.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,34 +60,34 @@ def set_repository(owner, repo)
}
end

# Thank you snowe wherever you are!
# https://stackoverflow.com/a/43374518
def calc_total(repo, repo_info)
begin
number_of_items_in_first_page = @client.send(repo_info, repo).size
repo_sum = 0
if number_of_items_in_first_page >= 100
links = @client.last_response.rels

unless links.empty?
last_page_url = links[:last].href

/.*page=(?<page_num>\d+)/ =~ last_page_url
repo_sum += (page_num.to_i - 1) * 100 # we add the last page manually
repo_sum += links[:last].get.data.size
end
else
repo_sum += number_of_items_in_first_page
# Thank you snowe wherever you are!
# https://stackoverflow.com/a/43374518
def calc_total(repo, repo_info)
begin
number_of_items_in_first_page = @client.send(repo_info, repo).size
repo_sum = 0
if number_of_items_in_first_page >= 100
links = @client.last_response.rels

unless links.empty?
last_page_url = links[:last].href

/.*page=(?<page_num>\d+)/ =~ last_page_url
repo_sum += (page_num.to_i - 1) * 100 # we add the last page manually
repo_sum += links[:last].get.data.size
end
else
repo_sum += number_of_items_in_first_page
end
rescue Octokit::Forbidden
# used in rare cases like torvalds/linux

repo_sum = '∞'
end
rescue Octokit::Forbidden
# used in rare cases like torvalds/linux

repo_sum = '∞'
repo_sum
end

repo_sum
end

# Public: get branches and number of contributors for a repository
#
# Returns number of branches
Expand Down
2 changes: 1 addition & 1 deletion public/img/ASSETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ Steady | False | true

Castor| Flynn | Infection
------|-------|----------
![](characters-extra/castor.gif) | ![](characters-extra/flynn-young.png) | ![](characters-extra/infected-program.png)
![](characters-extra/castor.gif) | ![](characters-extra/flynn-young.png) | ![](characters-extra/infected-program.png) ![](characters-extra/infection.png)

## Logo

Expand Down
Binary file added public/img/characters-extra/infection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 02ea1d2

Please sign in to comment.