Skip to content

Instantly share code, notes, and snippets.

View snuggs's full-sized avatar
👤
Committing

Ahmid-Ra snuggs

👤
Committing
View GitHub Profile
@snuggs
snuggs / some_controller.rb
Created February 15, 2023 12:50 — forked from mlt/some_controller.rb
Stream PostgreSQL query with potentially huge result set as CSV using gzip compression in Rails and low memory overhead
headers['X-Accel-Buffering'] = 'no'
headers['Cache-Control'] = 'no-cache'
headers['Content-Type'] = 'text/csv; charset=utf-8'
headers['Content-Disposition'] = 'inline; filename="data.csv"'
headers['Content-Encoding'] = 'gzip'
sql = "select * from something;"
self.response_body = SqlToCsvStreamer.new(sql)
@snuggs
snuggs / speedshop.md
Created May 8, 2017 14:45 — forked from nateberkopec/speedshop.md
Speedshop Contract

This is a Services Agreement between The Speedshop Ltd. Co. (“we,” “us,” “our”) and any individual, entity, or organization that procures our services (“you” or “your”).

  1. Acceptance of Terms: Any work that we do for you is governed by the terms and conditions that you’re reading now. If you don’t agree to them, we can’t provide you with any services. This agreement is a binding contract between you and The Speedshop.
  2. Terms May Change: Periodically, we may change the terms and conditions in this agreement, including the amount of our fees. If we do change any of these terms, they’ll take effect for you the next time that you contract for our services. Any work that we’ve already completed or previously initiated for you continue to be governed by the agreement in effect at the time that you contracted with us.
  3. Taxes: You are responsible for payment of all applicable sales and use taxes.
  4. Refund: If you’re genuinely dissatisfied with our services and provide us with notice within thirty (30) days of
@snuggs
snuggs / Gemfile
Last active November 18, 2020 22:48 — forked from calebwoods/Gemfile
Simple standalone ActiveRecord setup.
source 'https://rubygems.org'
gem 'activerecord', '>= 4.2.0'
gem 'sqlite4'