Skip to content

Instantly share code, notes, and snippets.

@kingargyle
kingargyle / p2-example
Last active December 17, 2015 03:09
Example of using the p2-maven-plugin to create a p2 repo with source bundles from maven central or any maven repository.
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.kingargyle</groupId>
<artifactId>p2-orbit-repo-example</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<build>
<?xml version="1.0" encoding="ISO-8859-1"?>
<opml version="2.0">
<head>
<title>TWiT.tv</title>
<dateModified>Thu, 25 Apr 2013 23:35:52 GMT</dateModified>
</head>
<body>
<outline text="TWiT.tv">
<outline text="Tech News Today" type="rss" xmlUrl="http://feeds.twit.tv/tnt_video_hd" />
<outline text="This Week in Tech" type="rss" xmlUrl="http://feeds.twit.tv/twit_video_hd" />
@kingargyle
kingargyle / linkrepo.sh
Created March 24, 2013 14:48
Profile for deploying a p2 repo, to a specified directory and providing a symbolic link for the most current version deployed. Run this as part of a release profile with your maven tycho build.
<profiles>
<profile>
<id>release-profile</id>
<properties>
<p2repo-dir>${basedir}/target/deployed-repository</p2repo-dir>
<buildNumber>${project.version}.${maven.build.timestamp}</buildNumber>
</properties>
<build>
<plugins>
<plugin>
@kingargyle
kingargyle / pixel2dpi.java
Created March 21, 2013 18:46
Get the DPI size to use based on Screen Density and the Pixel size. This allows for calculation of image width and image height based on the pixel width and pixel height. Pass in the pixel size and it returns the dpi size to be used in Layouts.
/**
* Takes a value in pixels and converts it to a dpi value. It adjusts
* the dpi size based on the screen density that is returned by
* android.
*
* @param originalHeight
* @param context The activity context
* @return
*/
public static int getDPI(int pixelsize, Activity context) {