News for hackers. Stuff that matters.
Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by efexen on Monday December 28, 2015 @07:03AM (#10800748)
Thanks for the comment! I've got a plan of integrating with Github, just trying to decide how it should work as I wouldn't want my commits from work showing up which are on the same github account.

Do you think it'd work well if I implemented something to allow picking a commit for a daily entry or would you prefer more automatic tracking?

Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by nosefrog on Monday December 28, 2015 @07:54AM (#10800894)
When I looked into this, I used the GitHub Events API to get all of the events the user took[0], and then filtered by Push Events. Push Events consist of commits to a repo, and I used the GetCommit Repository API [1] to get more metadata for the commit.

If you save the ETag from the Events API and pass it back in your next request, you'll get a 304 response if the data hasn't changed and it won't hit your request limit.

You'll want to poll the user's events periodically, and store that data in a database. It's too slow to ping GitHub's API every time, because there isn't a single API that provides exactly what you need.

Check out FetchRecentCommits[2] for how I hit the GitHub API, and UpdateUserCommits[3] and CreateCommit[4] for how I extract the data from the commit and store it in the database.

Good luck! Keep me updated, my username is in my profile :)

[0] https://developer.github.com/v3/activity/events/#list-public...

[1] https://developer.github.com/v3/repos/commits/#get-a-single-...

[2] https://github.com/samertm/githubstreaks/blob/master/model.g...

[3] https://github.com/samertm/githubstreaks/blob/master/model.g...

[4] https://github.com/samertm/githubstreaks/blob/master/model.g...

Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by NicoJuicy on Monday December 28, 2015 @07:09AM (#10800768)
I think automatic tracking of public repositories for now would do ok ( if you can check on that). I wouldn't do "picking commits", because people mostly won't do that.

Nice project!

Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by efexen on Monday December 28, 2015 @07:20AM (#10800795)
Thanks for the feedback, glad you said tracking public repositories as that's something I thought might work well as mostly peoples work is in private repos
Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by NicoJuicy on Tuesday December 29, 2015 @12:22AM (#10805365)
If you would go for private repos, i think it would be harder.

Public git repositories on github are an alternative for your resume ( that's good for your project). But private repositories could also mean gitlab integration and etc.. :)

Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by toyg on Monday December 28, 2015 @03:24PM (#10803144)
I honestly don't know what work is involved, but if you integrate with Github, please do the same for BitBucket. BB gets less visibility because most people use it to keep their repositories private, but it's used by a huge amount of people for real work and personal projects.
Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by efexen on Monday December 28, 2015 @03:33PM (#10803193)
I was just collating some of the feedback from this and right next to Github integration I wrote BB integration :) I use BB a lot as well personally to keep repos private. Thanks for the feedback
Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by kybernetyk on Monday December 28, 2015 @08:47AM (#10801035)
Maybe come up with a git hook that posts an update to your API on every commit/push?

This way it would be independent from GitHub (we're not using GH at work for example).

Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by dschoppe on Monday December 28, 2015 @07:10AM (#10800772)
Perhaps automatic tracking could have the option to exclude certain repos?
Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by efexen on Monday December 28, 2015 @07:21AM (#10800800)
Sounds like a good idea, need to figure out how the management of that would work though without being a PITA ;) Thanks for the idea, much appreciated!
Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by iamtew on Monday December 28, 2015 @07:53AM (#10800893)
Or how about the user explicitly adds the repositories they want to have shown, or provides a pattern they want tracked?

For example: "Track all my GitHub repositories matching /^codehalf-*/

Re:Show HN: CodeHalf – Write Code Everyday, new design and n... by jon-wood on Monday December 28, 2015 @07:34AM (#10800845)
Or organisations.