Skip to content

Instantly share code, notes, and snippets.

View fmedlin's full-sized avatar

Fred Medlin fmedlin

View GitHub Profile
#include <stdio.h>
int main (int argc, char** argv)
{
printf("How do I delete gists?\n");
}
@fmedlin
fmedlin / Java system properties.java
Created December 11, 2008 14:17
Java system properties
/*
System.getProperty()
Key Description of Associated Value
java.version Java Runtime Environment version
java.vendor Java Runtime Environment vendor
java.vendor.url Java vendor URL
java.home Java installation directory
java.vm.specification.version Java Virtual Machine specification version
@fmedlin
fmedlin / robomake.rb
Created May 8, 2010 03:58
A script to watch and rebuild Android NDK projects
#! /usr/bin/ruby
# A script to watch files and build Android NDK projects
interrupted = false
trap("INT") { interrupted = true }
def print_separator
puts "============================================="
end
describe Preferences, "what I'd rather have" do
it "should be a bottle in front of me" do
end
it "should not be a frontal lobotomy" do
end
end
describe Truck, "while in possession" do
describe Preferences, "what I'd rather have" do
it "should be a bottle in front of me" do
end
it "should not be a frontal lobotomy" do
end
end
@fmedlin
fmedlin / xcpushpop
Created December 5, 2010 21:10
Rentzsch's XCode and IB doc handler script (http://rentzsch.tumblr.com/post/1578770735/xcpushpop)
tell application "System Events"
if exists file ".xcpushpop.plist" of home folder then
-- pop/restore
set plist to property list file "~/.xcpushpop.plist"
set xcList to value of property list item "xc" of plist
set ibList to value of property list item "ib" of plist
repeat with xcItem in xcList
tell application "Xcode" to open xcItem
end repeat
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" >
<shape>
<gradient
android:startColor="@color/blue1"
android:endColor="@color/blue2"
android:angle="270" />
<stroke
android:width="3dp"
@fmedlin
fmedlin / LocationDemo.java
Created February 28, 2011 17:06
Marko Gargenta's Android Location API Demo
// http://marakana.com/forums/android/examples/42.html
package com.marakana;
import java.util.List;
import android.app.Activity;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationListener;
@fmedlin
fmedlin / TouchImageView.java
Created November 1, 2011 02:00
An integrated approach to gesture handling.
public TouchImageView extends ImageView {
public TouchImageView(Context context) {
int mode = NONE;
setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
switch(event.getAction()) {
case MotionEvent.ACTION_POINTER_DOWN:
if (twoFingerTouch(event)) {
setPinchMidpoint(event);
@fmedlin
fmedlin / TouchImageActivity.java
Created November 9, 2011 02:57
Remove touch handling and add image manipulation methods.
public TouchImageActivity extends Activity {
TouchImageView imageView;
PinchGestureDetector pinchDetector = PinchGestureDetector.newInstance(this,
new OnGestureListener() {
public void onScale(float scaleFactor, float pivotX, float pivotY) {
imageView.zoomToPivot(scaleFactor, pivotX, pivotY);
}
public void onDrag(float dx, float dy) {
imageView.translate(dx, dy);