Skip to content

Instantly share code, notes, and snippets.

%form(action="https://www.berlinlinienbus.de/affiliate/affiliate_booking.php" method="post" id="form" accept-charset="utf-8")
= hidden_field_tag :departure, trip.dep.remote_handle[0,5]
= hidden_field_tag :destination, trip.arr.remote_handle[0,5]
= hidden_field_tag :ticket_art, 'TNT'
= hidden_field_tag :date, time.strftime( "%Y-%m-%d" )
= hidden_field_tag :time, time.strftime( "%H:%M" )
= hidden_field_tag :curr_lang, 'de'
= hidden_field_tag 'partner_ID', 'mVya2VocnNtaXR0ZWx2ZXJnbGVpY2g2NDgw'
$(function() {
// Username from pinnerLink
$.fn.username = function() {
href = $(this).attr('href')
return href.substr(1,href.length - 2)
}
$.fn.pinnerLink = function() {
return $(this).find('.pinUserAttribution a.firstAttribution')
}

development:

  • install resque
  • replace AJAX downloading with new background job
  • create worker that executes query, emails when done

deployment:

  • install redis
  • install resque gem via rake gems:install
@ordinaryzelig
ordinaryzelig / segment.xml
Last active December 16, 2015 22:09
Aachen hbf (8000001) to Köln KD (8075938) API response
<ns6:Schedule pr="RE, STR" nt="1" dur="00d01:24:00" dt="20130504" sid="0" dir="H">
<ns6:TrainList>
<ns6:Train lt="Transport" tn="RE 10149" arr="00d01:51:00" dep="00d00:51:00" d="8003368" dn="Köln Messe/Deutz" s="8000001" sn="Aachen Hbf" tid="0.0"/>
<ns6:Train lt="Walk" arr="00d01:58:00" dep="00d01:51:00" d="444510" dn="" s="8003368" sn="Köln Messe/Deutz"/>
<ns6:Train lt="Transport" tn="STR 1" arr="00d02:05:00" dep="00d02:02:00" d="444507" dn="" s="444510" sn="" tid="0.1"/>
</ns6:TrainList>
</ns6:Schedule>

The story

  • given customer is on carpoolin.com/someurl/results/123
  • press a button, their Frontend sends it to their Backend, their frontend sends fare_id to SS and polls for the url
  • in the meanwhile the user will see 'their' waiting page
  • we return a url
  • their frontend redirects/blanks new page whatever our url (our waiting page)
  • as soon as we can we redirect/submit form with js to send the user to the agency

Proposed process

@ordinaryzelig
ordinaryzelig / gist:5912786
Created July 2, 2013 20:25
DVR conversation
Oki, I'll call it the InsaneHypermediaApiProfileTester.
dn: Stay for me for a second :-)
Jared Ning: :)
dn: let's say we already got the HC client
dn: we now build the IHAPT Gem
dn: hc = HC.connect('localhost:9393')
dn: IHAPT.build_profile hc
dn: def build_profile
# visit '/'
# visit all forms & record inputs/required etc
15:52:50 pathfinder.1 | 2013-07-15T20:52:50Z 80536 TID-oxsyqylsc SearchService::CompositeSearchBuilder JID-b5377063eba252d41b97e3b8 INFO: fail: 60.003 sec
15:52:50 pathfinder.1 | 2013-07-15T20:52:50Z 80536 TID-oxsyqylsc WARN: {"retry"=>false, "queue"=>"pathfinding", "backtrace"=>true, "timeout"=>60, "class"=>"SearchService::CompositeSearchBuilder", "args"=>[{"start_latitude"=>50.7678, "start_longitude"=>6.091499, "end_latitude"=>52.525592, "end_longitude"=>13.369545, "vehicle_flags"=>7, "third_party_id"=>1, "created_at"=>nil, "updated_at"=>nil, "uuid"=>"7356fa77-2f26-46b4-a798-0e01709fec1f", "departure_time"=>"2013-07-17"}], "jid"=>"b5377063eba252d41b97e3b8"}
15:52:50 pathfinder.1 | 2013-07-15T20:52:50Z 80536 TID-oxsyqylsc WARN: execution expired
15:52:50 pathfinder.1 | 2013-07-15T20:52:50Z 80536 TID-oxsyqylsc WARN: /Users/ningja/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:185:in `lock'
15:52:50 pathfinder.1 | /Users/ningja/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/monitor.rb:185:in `mon_enter'
15:52:5
require 'sequel'
require 'pg'
db_config = {
adapter: 'postgres',
host: 'localhost',
database: 'asdf',
max_connections: 10,
}
class Asdf
URL = 'http://asdf.com'
def build_url(extra_stuff)
URL << extra_stuff
end
end
10.times do |idx|
puts Asdf.new.build_url("?idx=#{idx}")