Skip to content

Instantly share code, notes, and snippets.


Joshua Moody jmoody

View GitHub Profile
View gist:948820
def create
params.each do |key,value|
logger.warn "Param #{key}: #{value}"
url_args = { :latitude => params["longitude"], :longitude => params["longitude"] }
logger.debug "url_args = #{url_args}"
@count_threshold =
jmoody / finalizeData => init
Created May 4, 2011
proposed changes to MamRendererWrapper
View finalizeData => init
I also think that the finalizeData method should be replaced.
If both the initRenderer and finalizedData were pushed to an init method, the signature might be:
- (id) initWithScriptName:(NSString *) aScriptName;
or something like that (maybe it is initWithScriptDirectory).
This would as mean that the code that uses the renderer would not need to do stuff like this:
View gist:955463
- (NSDecimalNumber *) standardDeviationWithPreviousPoints:(NSArray *) dataPoints
event:(CountEvent *) event {
NSDecimalNumber *result;
if ([self canComputeNonMeanStatistics:dataPoints]) {
NSDecimalNumber *accumulator = [NSDecimalNumber zero];
NSArray *allMeans = [self arrayWithDataPoints:dataPoints event:event];
NSDecimalNumber *mean = [self mean:allMeans];
NSDecimalNumber *variance;
View example.csv - lacbcbikecount--iPhoneSimulator--2011_08_20_23_37.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 32 columns, instead of 30. in line 2.
1,00-15,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2011-08-20 23:37:23.582,0,0,0,2011-08-20 23:37:22.908,2011-08-20 23:37:30.850,Fake Name,Fake Weather with some False Clouds. Temp in the 36 C,Paris,Rue Michel Compte,Rue Beaubourg,,C7EBC91D-B2C0-462E-98D4-BCF9B6CA04AC,590171BE-7E65-492F-8FEB-4991DEBB56F1,lacbcbikecount--iPhoneSimulator--2011_08_20_23_37
2,00-15,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,2011-08-20 23:37:24.691,0,0,0,2011-08-20 23:37:22.908,2011-08-20 23:37:30.850,Fake Name,Fake Weather with some False Clouds. Temp in the 36 C,Paris,Rue Michel Compte,Rue Beaubourg,,DD4E1D74-BE
jmoody / gist:1183511
Created Aug 31, 2011
AgChoice Issue 8: payload specification of trade offer notification (from server)
View gist:1183511
"aps": {
"alert": {
"loc-args": [
"< commodity >",
"< grade >",
"< volume >",
"< delivery details >",
jmoody / gist:1188626
Created Sep 2, 2011
AgChoice: call to ValidateUser and the server response
View gist:1188626
This is the call:
"method": "ValidateUser",
"params": [
"userName": "some-user",
"password": "some-pass"
jmoody / gist:1199794
Created Sep 7, 2011
Sample AgChoice Bid Notifications
View gist:1199794
{"aps": {"alert": {"body": "Grain (Grade): APH1 Vol: 5,000\nDelivered Depot 20/08-31/12/11 —$188.24t", "action-loc-key": "View"}}, "aliases": ["mercury", "Jesco's iPhone"]}
jmoody /
Created Apr 14, 2012
script to help with calabash-ios testing - reveals the simulator so you can watch the tests run. saves having to command-tab from terminal to simulator.
/usr/bin/osascript -e 'tell application "iPhone Simulator" to activate'
NO_LAUNCH=1 OS=ios5 cucumber
jmoody / scroll-until.rb
Created Apr 14, 2012
cucumber step for calabash-ios that scrolls a view until a name is match or a limit is reached
View scroll-until.rb
Then /^I scroll (left|right|up|down) until I see "([^"]*)" limit (\d+)$/ do |dir,name,limit|
if (not element_exists("view marked:'#{name}'"))
count = 0
scroll("scrollView index:0", dir)
count = count + 1
end while ((not element_exists("view marked:'#{name}'")) and count < limit.to_i)
jmoody / keyboard_steps.rb
Created Jun 23, 2012
cucumber steps for interacting with native keyboard using calabash-cucumber
View keyboard_steps.rb
def should_see_keyboard
res = element_exists("keyboardAutomatic")
unless res
screenshot_and_raise "Expected keyboard to be visible."
def should_not_see_keyboard
res = element_exists("keyboardAutomatic")
if res