Sinatra in SIX lines - How to do crazy stuff with Ruby
summary
A Sinatra-compatible implementation compresses core behavior into six lines, implementing configure blocks, sessions, helpers, before filters, route params and inline templates by leaning on Rack Tilt and Sprockets and using tricks (pack, here-docs, flip‑flops, global request, method objects) to shave bytes; a separate almost rack three-line runner handles config.ru, and an almost rack protection middleware outright rejects attacks (reportedly handling ~9,000 requests in an hour); people run it in production and blog analyzers parse the obfuscated-but-working code.
AI-written summary · about
chapters (16)
- 0:00Intro
- 0:22Twitter handle
- 0:52Discount code
- 1:31Realtime Rails Ruby
- 2:02Code Slides
- 2:42Fun Ruby code
- 5:20Docks
- 8:40Flipflops
- 10:44Flipflops for Rubinius
- 13:24Sinatra in 6 lines
- 14:16Sinatra implementation
- 18:16Sinatra methods
- 25:41Coding guidelines
- 27:46Rackup
- 31:45Almost Wreck Protection
- 36:23Conclusion
related talks
36m10 years of Sinatra
37mRuby on Rack: The Magic Between Request and Response
30mThe Power of Middleware - Building Your Own Mini Web Framework on Rack
16mOne Ruby App to Rule Them All
26mAdventures in Paranoia with Sinatra and Sequel
38mRewriting Rack: A Functional Approach
01h 12mRuby Best Practice Patterns
29mQuick and Dirty Apps with Sinatra, DataMapper, RestClient & Heroku
