Skip to content

Instantly share code, notes, and snippets.

Sinatra accepts a number of different types in the results processing code, and processes/displays them in the following order:
nil
===
If nil is passed to the results, then just the standard Sinatra headers are returned to the client, in the following example
-- test.rb
get "/test/" do
nil
@dashdotat
dashdotat / gist:8025768
Created December 18, 2013 16:55
NRPoller
require 'socket'
require 'stomp'
class NrPollerPoller
def initialize
@hostname = 'datafeeds.networkrail.co.uk'
@username = '<username used at https://datafeeds.networkrail.co.uk/ntrod/login>'
@password = '<password used at https://datafeeds.networkrail.co.uk/ntrod/login>'
puts 'Stomp consumer for Network Rail Open Data Distribution Service'

Keybase proof

I hereby claim:

  • I am dashdotat on github.
  • I am dashdotat (https://keybase.io/dashdotat) on keybase.
  • I have a public key whose fingerprint is 02B1 38AC E4FA 7F47 E376 0255 DE0E 32D1 092E 3D04

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am dashdotat on github.
  • I am dashdotat (https://keybase.io/dashdotat) on keybase.
  • I have a public key ASBKdtXbMYJ5ys4J4qbjtce-kRJIgt_VKGBQY-NijYmmKAo

To claim this, I am signing this object:

{"type":"schedule","action":"create","source":"cif","train_uid":"C74092","runs_from":"2017-04-28","runs_to":"2017-04-28","days_runs":"0000100","bank_holiday_running":"","train_status":"P","train_category":"XZ","train_identity":"1B16","headcode":"6002","course_indicator":"1","train_service_code":"23559004","portion_id":"2","power_type":"D","timing_load":"350","speed":"125","operating_characteristics":[],"seating_class":"S","sleepers":"B","reservations":"A","connection_indicator":"","catering_code":["R"],"service_branding":[],"stp_indicator":"O","weight":20,"traction_class":"","uic_code":"","atoc_code":"CS","applicable_timetable":"Y","locations":[{"tiploc_code":"ABRDEEN","tiploc_instance":"","departure":"21:43:00","public_departure":"21:43:00","platform":"3","line":"","engineering_allowance":0,"pathing_allowance":0,"performance_allowance":0,"activity":["TB"],"next_day_arrival":false,"next_day_departure":false,"sequence":10},{"tiploc_code":"ABRDFJN","tiploc_instance":"","arrival":null,"departure":null,"pass":"21