Skip to content

Instantly share code, notes, and snippets.

View dbaldwin's full-sized avatar

Dennis Baldwin dbaldwin

View GitHub Profile
brew tap homebrew/science
brew install eigen # This was key for opencv to build
brew info opencv
brew install opencv
ln -s /usr/local/Cellar/opencv/2.4.9/lib/python2.7/site-packages/cv.py cv.py
@dbaldwin
dbaldwin / gist:1837757
Created February 15, 2012 17:53
JavaScript for basic CSS fixed overlay centered on page
var d = document.createElement("div");
d.style.background = "#FFFF00";
d.style.top = 0;
d.style.position = "fixed";
d.style.top = "50%";
d.style.left = "50%";
d.style.marginLeft = "-150px";
d.style.zIndex = "100000";
d.style.width = "300px";
var t = document.createTextNode("Message goes here...");
@dbaldwin
dbaldwin / gist:3100217
Created July 12, 2012 19:10
iOS5 gist for changing the tabbar background image. This is an example done in AppDelegate.
//
// AppDelegate.h
// TabBar
//
// Created by Dennis Baldwin on 7/12/12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@dbaldwin
dbaldwin / gist:3102801
Created July 13, 2012 04:55
iOS5 snippet for calling a welcome screen segue when a UITableView has 0 items in it
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if(_objects.count == 0) {
[self performSegueWithIdentifier: @"welcomeSegue" sender: self];
}
return _objects.count;
}
@dbaldwin
dbaldwin / gist:3124186
Created July 16, 2012 18:30
Display barcode scanning rectangle area in overlay with RedLaser SDK
- (void)viewDidLoad
{
[super viewDidLoad];
// Create rectangle layer and add it to view
rectLayer = [CAShapeLayer layer];
rectLayer.fillColor = [[UIColor colorWithRed:1.0 green:0.0 blue:0.0 alpha:0.2] CGColor];
rectLayer.strokeColor = [[UIColor whiteColor] CGColor];
rectLayer.lineWidth = 3;
[self.view.layer addSublayer:rectLayer];
@dbaldwin
dbaldwin / gist:3170422
Created July 24, 2012 14:53
iOS gist for doing something only the first time an app is run
- (void)viewDidLoad
{
[super viewDidLoad];
// Get a reference to the user defaults database
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// If this is the first run we're going into this if statement
if(![defaults objectForKey:@"firstRun"])
{
@dbaldwin
dbaldwin / gist:3171007
Created July 24, 2012 16:24
iOS gist for randomly getting a value from a static array
NSArray *upcs = [NSArray arrayWithObjects:@"018208254682", @"885909459865", @"885909480982", @"989898293469", @"725882475691", @"9780060766863", @"9780066620992", nil];
NSString *upc = [upcs objectAtIndex:random()%[upcs count]];
[product setValue: upc forKey: @"upc"];
2016-04-12 14:36:10.659 DronePan[1059:246203] New product
2016-04-12 14:36:25.083 DronePan[1059:246203] angle: 320.700000
2016-04-12 14:36:25.085 DronePan[1059:246203] angle: 380.700000
2016-04-12 14:36:25.087 DronePan[1059:246203] angle: 440.700000
2016-04-12 14:36:25.089 DronePan[1059:246203] angle: 500.700000
2016-04-12 14:36:25.091 DronePan[1059:246203] angle: 560.700000
2016-04-12 14:36:25.094 DronePan[1059:246203] angle: 620.700000
2016-04-12 14:36:25.095 DronePan[1059:246307] *******************
2016-04-12 14:36:25.096 DronePan[1059:246307] Starting loop with yawSpeed: 30.000000 and yawDestination: 320.700012
2016-04-12 14:36:25.097 DronePan[1059:246307] *******************
@dbaldwin
dbaldwin / gist:ab9c33bdf839f4a38a9951f21b6a66e9
Created June 5, 2016 20:07
DronePan Unable to set gimbal attitude
W: 2016/06/05 12:03:49:133 [com.dronepan.queue.gimbal/1755300] GimbalController setAttitude(_:pitch:yaw:roll:) line: 420 Gimbal Controller setAttitude hasn't completed yet count: 1
D: 2016/06/05 12:03:49:133 [com.dronepan.queue.gimbal/1755300] GimbalController setAttitude(_:pitch:yaw:roll:) line: 363 Setting attitude: count 2, pitch 30.0, yaw 0.0, roll 0.0
D: 2016/06/05 12:03:50:145 [com.dronepan.queue.gimbal/1755466] GimbalController check(pitch:yaw:roll:) line: 287 Checking PA: true P: 30.0 CP: 29.9
D: 2016/06/05 12:03:50:145 [com.dronepan.queue.gimbal/1755466] GimbalController check(pitch:yaw:roll:) line: 288 Checking YA: true Y: 0.0 CY: 60.6 CACY: 64.1 ACY: 3.5
D: 2016/06/05 12:03:50:145 [com.dronepan.queue.gimbal/1755466] GimbalController check(pitch:yaw:roll:) line: 289 Checking RA: false R: 0.0 CR: 0.0
W: 2016/06/05 12:03:50:145 [com.dronepan.queue.gimbal/1755466] GimbalController setAttitude(_:pitch:yaw:roll:) line: 420 Gimbal Controller setAttitude hasn't completed yet count: 2
D: 2016/06/05 12:03:50
@dbaldwin
dbaldwin / gist:4009f1957da16890b55c6d94a2a4ab5b
Created June 6, 2016 14:09
DronePan yaw did not complete
D: 2016/06/06 09:03:23:364 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current heading 0.0
D: 2016/06/06 09:03:23:466 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current heading 0.0
D: 2016/06/06 09:03:23:564 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current heading 0.0
D: 2016/06/06 09:03:23:660 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current heading 0.0
D: 2016/06/06 09:03:23:780 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current heading 0.0
D: 2016/06/06 09:03:23:781 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current heading 0.0
D: 2016/06/06 09:03:23:871 [com.apple.main-thread/1780979] FlightController flightController(_:didUpdateSystemState:) line: 159 Current