Iterate through Github profile JSON - json

I'm trying to write a simple webapp that'll check the JSON feed of my Github profile and simply let me know if I submitted any commits on a daily basis. I remember seeing something like it before but I can't find it now, so I'd like to recreate it instead.
I have pretty limited knowledge of JSON: I know that my feed shows the date for each commit, so I suppose I need to write some sort of if conditional to check the current date against any commits in the JSON feed, correct?
Also, does anyone have any recommendations for what kind of language would be best for this? Is Javascript too simple? Rails too much? Thanks.

You can leverage the Events API from GitHub to do this.
The following url displays the list of events you've triggered.
https://api.github.com/users/imkmf/events
If you're willing to only list your commit activity, you would have to filter the events in order to only deal with the PushEvent.
Some may argue that a Gist is also a Git repository and that creating/updating a Gist is similar to performing a Commit. In that case, make sure to also consider the GistEvent.
I've wrapped a little sample for you based on your GitHub profile showing your commit log for the last seven days.
You can see a live demo here.
Note: In order to ease the manipulation of dates, the code leverages the moment.js JavaScript library

Related

The best way to grab JSON data from website and put it in CSV?

I tagged this question as "conceptual" because I'm not sure if creating Chrome Extension is the best way. In my opinion it's better to ask before spending few hours writing something and find out that some part is too much difficult or impossible.
The problem
I used to analyze my finance using csv files downloaded from bank account. But as it sometimes happens, my bank launched new GUI and csv feature disappeared. They do not know when and whether they will do it at all. So I have to grab transactions in some way and put them in CSV file.
Concept of solution
I think scrapping the page with transactions it's not good way, because whole data is looking like generated with totally random CSS classes and ids. I noticed that list of transactions is sent in JSON format by AJAX response. I analyzed that JSON and every interested field has name, so access to data is quite easy. Only one problem I see, it's that first JSON load shows only first 10 transactions. To load more I have to scroll down, then there is next AJAX request to the same URI, then next JSON load comes in response. So, if I want to get transactions from whole month I have to scroll few times down and my tool should catch first and also next responses.
I don't have experience with Chrome Extensions but they claim that if I know web technologies like JS, CSS, HTML it shouldn't be difficult to write simple extension. If I can take this JSON from AJAX response to my extension then generating CSV file shouldn't be problem.
The question
The main question is if my concept is possible to realize. Is there easy access to data loaded from AJAX response? If you see any better solution I'm open to suggestions.
you can create CSV file from Json in DOM (don't required to call any API).
Please refer this demo link
jsfiddle.net/hybrid13i/JXrwM/
if you care implemented this functionality in chrome extinction so you need to add download permission in manifist.json https://developer.chrome.com/extensions/downloads

Make an item display only for certain period of time on the webpage

Hi guys I am constructing a task distribution management system for my team in which I want to add a functionality that:
When I create a task, I will have an option to choose "how long is this task valid for being taken". For example, when creating the task I put "2 hours" in the
<input id="valid-for">
, then this task will only be displayed on the dashboard for 2 hours from the time it was created and then after 2 hours -> "display: none".
I've searched the web for the mechanism of achieving this feature but I didn't get a satisfied answer probably because I don't know the right terminology to google. I tried to use AJAX and use TIME_STAMP type attribute in MySQL but didn't know how to proceed. Could anybody tell me how to achieve this feature by the use of MySQL, jQuery or any other technics that could fulfill this feature? No code necessary I just need some explanation.
Thanks guys!
Without knowing any more details, here is how I would consider writing the code:
In the database, have a start time and a use-by time.
In your browser page, you can run a script periodically, say every minute (this is called polling). In this case, you can use Ajax to call back to the server for updates.
At the server end, check for new tasks as well as expired tasks. Then send the results back to the Ajax caller.
Back at the browser, update the dashboard accordingly.
I would be inclined to remove the task on the browser rather than simply hide it.

Is there a way to find the date when a certain key was added to an amenity in OpenStreetMaps?

As an example: I'd like to know, when was the Key "tourism" added (or last edited) of this amenities:
http://overpass-turbo.eu/s/1N4
I tried with different APIs but didn't get very far.
Is there a way over any API or do I have to get as SQL Snapshot and somehow look for the last changeset?
You can use the history call of the main OSM API if you know the IDs of the objects wich you want to inspect. The resulting XML includes all versions of the respective object, thus allows one to determine when certain changes were made:
http://www.openstreetmap.org/api/0.6/node/277528308/history
Overpass API supports these kinds of queries since version 0.7.50. Referring to the History API call or extracting that details from a full history planet wouldn't be necessary anymore.
Please refer to this post with more details on diff and adiff keywords.
As the overpass database rebuild is still ongoing, I'll add a working example to this post a bit later. At the moment, June 2014 would be the earliest possible starting date for queries.

TortoiseHG/Mercurial Project Statistics and Reports

I've been working for a couple months on cleaning up the backend of a system I'm working on. The previous code was awful so I've been refactoring and rewriting to get the code to a state where I can better add and improve functionality. I want to be able to quantify the work I've done for the client so he can get a sense of how much work has been done. So, I want to run some reports showing things like: number of lines removed, added, changed. I've used TortoiseHG/Mercurial all along and also have pushed the code up to bigbucket.
What's the best way to generate these types of statistics from TortoiseHG/Mercurial or BitBucket?
Churn extension
Activity extension
Chart extension
HG-chart extension
* HGstats, when sphinx.net.ru will be returned back in Net

TFS 2010 Change Log

Is there an automated way to create a change log using TFS 2010 and the version history of the files? I'd like to pull in all the comments that were entered for each changeset either between a label (or a specific date) and the current version, or between two labels (or two specific dates).
Try using http://tfschangelog.codeplex.com. this tool allows users to generate release notes against given set of changeset range. It extracts information in XML format for all the changesets within a given range along with associated work items. It then uses XSLT 2.0 to translate output from XML into HTML. This way, users can use apply their own logic for filtering, styling, reporting format, etc.
Hope this is useful.
Are you asking
Is there a tool already that does all of this for me?
OR
Can I automate this process?
If #1, my answer is "I don't know, but I would check CodePlex and the Microsoft TFS downloads on MSDN" for this type of tool.
If #2, there are web services you can use to query TFS. They don't have the "give me all changes between X and Y date or A and B release", but you can get information on changesets, work items, etc. As you would be creating a document, good check in note discipline is mandatory to get a coherent document, unless you just want to know what was actually changed in code, which I think is overkill.
Are the APIs mature enough to easily automate to create version 1.x changes are type of documents? My answer is no, but your mileage may vary.
The tf.exe command line tool with give you the history or more or more items between two points in the history where those points can be specified by date, label or changeset number.
Eg.
tf history /version:C5~C8 MyClass.cs
See the help on MSDN: http://msdn.microsoft.com/en-us/library/yxtbh4yh.aspx
Here is a simple CLI app that does just the job. It returns a changelog as text.
https://github.com/sandrock/tfchangelog
According to the sources, it enumerates changesets and outputs the comments in the terminal.