Skip to content

Instantly share code, notes, and snippets.

@Sorroko
Sorroko / User Repos GitApi
Created May 25, 2012 20:15
Dirty damn code for getting all the commits for all user repos
function GitStream() {
var sort_asc = function (commit1, commit2) {
if (commit1.date < commit2.date) return 1;
if (commit1.date > commit2.date) return -1;
return 0;
};
var commits = [];
var toDo = 0;
var done = 0;
@Sorroko
Sorroko / roundRect Canvas Rendering Function
Created May 22, 2012 18:11
Extends the Canvas Rendering context in javascript
CanvasRenderingContext2D.prototype.roundRect = function (x, y, w, h, r) {
if (w < 2 * r) r = w / 2;
if (h < 2 * r) r = h / 2;
this.beginPath();
this.moveTo(x+r, y);
this.arcTo(x+w, y, x+w, y+h, r);
this.arcTo(x+w, y+h, x, y+h, r);
this.arcTo(x, y+h, x, y, r);
this.arcTo(x, y, x+w, y, r);
this.closePath();