Skip to content

Instantly share code, notes, and snippets.

View brennon's full-sized avatar

Brennon Bortz brennon

View GitHub Profile
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@brennon
brennon / gist:12b449bc6a5c223ef230
Created November 20, 2014 04:33
Protractor conditional testing
describe('conditional testing', function() {
it('should be able to test conditionally', function() {
browser.get('http://www.angularjs.org');
element(by.css('.theresnowaythisclassexists')).then(
function elementExists() {
expect(false).toBe(true);
},
function elementDoesNotExist() {
expect(true).toBe(true);
}
@brennon
brennon / configure_liblo_iphone.sh
Created November 8, 2012 15:56 — forked from mikewoz/configure_liblo_iphone.sh
configure static liblo for armv7 & armv7s (iOS6)
./configure \
--host="arm-apple-darwin" \
--enable-static \
--disable-shared \
--disable-dependency-tracking \
CC=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
CPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 \
CXXCPP=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-cpp-4.2 \
CXX=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc \
AR=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/ar \
@brennon
brennon / gist:2395305
Created April 15, 2012 23:25
Problem examples
- (BOOL)directoryIsEmpty:(NSString *)path {
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([[fileManager directoryContentsAtPath:path] count] > 0)
return NO;
else
return YES;
}
- (BOOL)directoryIsEmpty:(NSString *)path {
NSFileManager *fileManager = [NSFileManager defaultManager];
// Interrupt service routine called to generate PWM compare values
ISR(TIMER1_COMPA_vect) {
// unsigned long == 32-bit
unsigned long sine_0, sine_1;
// These are the two ADC 'readings'. I've added a check that ensures that each remains >= 1023.
unsigned long reading_0 = (unsigned long) adc_readings[0] > 1023 ? 1023: (unsigned long) adc_readings[0];
unsigned long reading_1 = (unsigned long) adc_readings[1] > 1023 ? 1023: (unsigned long) adc_readings[1];
@brennon
brennon / adc_to_pwm.c
Created October 22, 2011 20:20
ADC -> PWM
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
// Uncomment to enable debugging messages and values
#define DEBUG
uint16_t adc_readings[8];
uint8_t digital_output = 11; // (PCINT22/OC0A/AIN0)PD6, Arduino Digital Pin 11
@brennon
brennon / redirect.rb
Created September 22, 2011 14:55
What's wrong with this redirect??
get '/foo' do
p 'in /foo'
redirect to('/bar')
end
get '/bar' do
p 'in /bar'
end
class Widget < ActiveRecord::Base
has_one :framework
end
class Framework < ActiveRecord::Base
belongs_to :widget
has_one :detail, :polymorphic => true
end
class InformationalFramework < ActiveRecord::Base