Skip to content

Instantly share code, notes, and snippets.

View tlivings's full-sized avatar

Trevor Livingston tlivings

View GitHub Profile
@tlivings
tlivings / ScriptObjectLoader.java
Created November 21, 2010 16:37
Simplistic utility class loads scripts into Java interfaces
public class ScriptObjectLoader {
public static ScriptEngineManager scriptEngineManager;
public static ScriptEngine engine;
static {
scriptEngineManager = new ScriptEngineManager();
engine = scriptEngineManager.getEngineByName("JavaScript"); //Or whatever
}
@tlivings
tlivings / zoom.m
Last active September 23, 2015 21:38
Example of zooming to user location in MKMapView when location annotation appears
- (void)mapView:(MKMapView *)mv didAddAnnotationViews:(NSArray *)views {
for(MKAnnotationView *annotationView in views) {
if(annotationView.annotation == mv.userLocation) {
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.05;
span.longitudeDelta=0.05;
CLLocationCoordinate2D location=mv.userLocation.coordinate;