Skip to content

Instantly share code, notes, and snippets.

View kevinsawicki's full-sized avatar

Kevin Sawicki kevinsawicki

View GitHub Profile
@kevinsawicki
kevinsawicki / MergeButton.java
Created August 19, 2011 21:55
Merge Button using GitHub Java API
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import org.eclipse.egit.github.core.IRepositoryIdProvider;
import org.eclipse.egit.github.core.MergeStatus;
import org.eclipse.egit.github.core.PullRequest;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.PullRequestService;
@kevinsawicki
kevinsawicki / UploadFile.java
Created August 2, 2011 23:39
Add downloads to a GitHub repository
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import org.eclipse.egit.github.core.Download;
import org.eclipse.egit.github.core.RepositoryId;
import org.eclipse.egit.github.core.client.GitHubClient;
import org.eclipse.egit.github.core.service.DownloadService;
/**
@kevinsawicki
kevinsawicki / GistCreator.java
Created May 18, 2011 00:26
Create Gists using the GitHub v3 Java API
GitHubClient client = new GitHubClient().setCredentials("user", "p4ssw0rd");
Gist gist = new Gist().setDescription("Prints a string to standard out");
GistFile file = new GistFile().setContent("System.out.println(\"Hello World\");");
gist.setFiles(Collections.singletonMap("Hello.java", file));
gist = new GistService(client).createGist(gist);
@kevinsawicki
kevinsawicki / Main.java
Created April 26, 2011 17:55
Main.java
public class Main {
/**
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return -1;
}
public static void main(String args[]) {
@kevinsawicki
kevinsawicki / SwtUtils.java
Created April 26, 2011 16:50
SWT utility method for disposing of a resource when the disposal of a widget occurs.
/**
* SWT Utilities.
*
* @author Kevin Sawicki (kevin@github.com)
*/
public abstract class SwtUtils {
/**
* Dispose of resource when widget is disposed.
*