Skip to content

Instantly share code, notes, and snippets.

View jmoody's full-sized avatar

Joshua Moody jmoody

  • Germany
View GitHub Profile
def create
params.each do |key,value|
logger.warn "Param #{key}: #{value}"
end
url_args = { :latitude => params["longitude"], :longitude => params["longitude"] }
logger.debug "url_args = #{url_args}"
@count_threshold = CountThreshold.new(url_args)
@jmoody
jmoody / finalizeData => init
Created May 4, 2011 07:16
proposed changes to MamRendererWrapper
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:
- (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;
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.
count,survey_interval,north_peds,north_bikes,south_peds,south_bikes,east_peds,east_bikes,west_peds,west_bikes,bikes_wrong_way,bikes_no_helmet,bikes_sidewalk_ride,wheelchairs,bikes_female,bikes_child,bikes_ped,occurrence_date,latitude,longitude,heading,survey_start_date,survey_end_date,surveyor_name,weather,location,north_south_street,east_west_street,surveyor_id,uuid,session_uuid,soft_session_uuid
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,lacbc.bikecount@gmail.com,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,lacbc.bikecount@gmail.com,DD4E1D74-BE
@jmoody
jmoody / gist:1183511
Created August 31, 2011 13:14
AgChoice Issue 8: payload specification of trade offer notification (from server)
https://github.com/jmoody/AgChoice/issues/8
{
"aps": {
"alert": {
"loc-args": [
"< commodity >",
"< grade >",
"< volume >",
"< delivery details >",
@jmoody
jmoody / gist:1188626
Created September 2, 2011 13:48
AgChoice: call to ValidateUser and the server response
This is the call:
{
"method": "ValidateUser",
"params": [
{
"userName": "some-user",
"password": "some-pass"
}
],
@jmoody
jmoody / gist:1199794
Created September 7, 2011 04:48
Sample AgChoice Bid Notifications
{"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
jmoody / cuke.sh
Created April 14, 2012 16:37
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
jmoody / scroll-until.rb
Created April 14, 2012 16:43
cucumber step for calabash-ios that scrolls a view until a name is match or a limit is reached
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
begin
scroll("scrollView index:0", dir)
sleep(STEP_PAUSE)
count = count + 1
end while ((not element_exists("view marked:'#{name}'")) and count < limit.to_i)
end
end
@jmoody
jmoody / keyboard_steps.rb
Created June 23, 2012 11:54
cucumber steps for interacting with native keyboard using calabash-cucumber
def should_see_keyboard
res = element_exists("keyboardAutomatic")
unless res
screenshot_and_raise "Expected keyboard to be visible."
end
end
def should_not_see_keyboard
res = element_exists("keyboardAutomatic")
if res