Dev Tip: Search for open PRs in Github for any user

Keeping track of all your open pull requests, PRs, in Github is hard.
This problem is multiplied when you contribute to multiple projects.
It’s even worse when you’re one of the few with merge rights to a popular repository with a lot of activity.

neovim pulse on github.com
neovim pulse on github.com

Luckily, Github has advance search features that allow you to instantly find open PRs from a user.
Here’s how.

1. Go to https://github.com/search
2. Find the username of the person on github. Their username is on their github profile under their name.
3. Search

is:open is:issue author:${USER_NAME}


Example:

is:open is:issue author:LarryBattle


Github search for my open PRs.

Larry's Open Prs
Larry's Open Prs

I’ve used this search recently to close a few PRs back from 2012!

Closed Old PR
Closed Old PR

Pro Tip:
If your organization uses Github, then make sure the developers close out PRs or reassign it to someone else before they leave the company.

More info:
Github Advance Search, useful for creating complex queries
Searching on github

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
TwitterLinkedInYouTube

Ratio.js – Fractions for javascript

Hey Everyone,
I created a project called Ratio.js. Basically the goal of the project is to provide an simple object for dealing with fractions in javascript.
Check it out here and tell me what this.

Ratio.js

Sample Code

 
// converts decimal values into the form of a fraction.
a = Ratio.parse(1/2);
a.toString() == "1/2";
 
// converts strings in the form of "a/b" to a fraction a/b.
a = Ratio.parse( "1/2" );
a.toString() == "1/2";
 
var result = Ratio.parse( 12.12121212121212 ).reduce().toString();
result == "400/33";

Simple Demo

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
TwitterLinkedInYouTube

Code of the day: jQuery, Get comments from HTML elements.

Code of the day: Get comments from HTML elements.
Here’s a simple jquery plugin to get the comments from a HTML elements.

// source code for $.fn.getComments()
$(function () {
/**
* $.fn.getComments() is used to extract the html comments from a HTML elements.
* 
* @author Larry Battle <http://bateru.com/news/contact-me>
* @license MIT
* @date June 11, 2012
* @version 0.1
* @args {boolean} asArray - If true, returns an array of the comments values. 
		Otherwise returns jquery objects of the node comments.
* @example 
	HTML:
	<div id="example">I am a div. <!--Duh!--></div>
 
	Javascript: 
	$("#example").getComments(true) // returns [ "Duh!" ]
*/
	var getCommentsFromEl = function (el, asArray) {
		var result,
		$el = $(el).contents();
		result = $el.filter(function () {
				return this.nodeType == 8;
			});
		if (asArray) {
			result = $.makeArray(result.map(function () {
						return this.nodeValue;
					}));
		}
		return result;
	};
	$.fn.getComments = function (asArray) {
		return getCommentsFromEl(this, asArray);
	};
});

Demo and testcases here: http://jsfiddle.net/96rux/

Fork this on Github.com
https://github.com/LarryBattle/jQuery.getComments

Larry Battle

I love to program, and discover new tech. Check out my stackoverflow and github accounts.

More Posts - Website

Follow Me:
TwitterLinkedInYouTube