- Browser
- Proxy
- Gateway
TODO Difference between proxy and gateway caches.
| # Example of using SQLite VSS with OpenAI's text embedding API | |
| # from Ruby. | |
| # Note: Install/bundle the sqlite3, sqlite_vss, and ruby-openai gems first | |
| # OPENAI_API_KEY must also be set in the environment | |
| # Other embeddings can be used, but this is the easiest for a quick demo | |
| # More on the topic at | |
| # https://observablehq.com/@asg017/introducing-sqlite-vss | |
| # https://observablehq.com/@asg017/making-sqlite-extension-gem-installable |
| /** | |
| * add console.js at ther root of your app | |
| * Modify to make it more helpful for your project | |
| * > Note: `esm` adds ES6 support in Node | |
| * In package.json | |
| * ... | |
| * "scripts": { | |
| * "start": "nodemon -r esm ./server.js" | |
| * "console": "node -r esm --experimental-repl-await console", | |
| * } |
| require 'active_record/log_subscriber' | |
| class SlowQueryLog < ActiveSupport::LogSubscriber | |
| if Rails.configuration.respond_to?(:slow_query_log_threshold_in_ms) | |
| if @@threshold = Rails.configuration.slow_query_log_threshold_in_ms | |
| @@threshold = @@threshold.to_i == 0 ? nil : @@threshold.to_i | |
| end | |
| else | |
| @@threshold = nil |
| #!/sbin/openrc-run | |
| description="Caddy web server" | |
| description_reload="Reload configuration" | |
| extra_started_commands="reload" | |
| : ${CADDY_CONF:=/etc/caddy/Caddyfile} | |
| : ${CADDY_PIDFILE:=/var/run/caddy.pid} | |
| : ${CADDY_USER:=caddy} |
| class Logger | |
| private_class_method :new | |
| @@instance = nil | |
| def info(msg) | |
| puts msg | |
| end | |
| def self.instance | |
| @@instance = new unless @@instance |
| # docker build -t="rails" . | |
| FROM ubuntu:12.04 | |
| RUN apt-get update | |
| ## MYSQL | |
| RUN apt-get install -y -q mysql-client libmysqlclient-dev | |
| ## RUBY |
| source 'https://rubygems.org' | |
| gem 'capybara' | |
| gem 'rake' | |
| gem 'selenium-webdriver' | |
| gem 'json' | |
| gem 'rmagick' | |
| <form action="http://v0.api.upyun.com/rbtest/" method="post" enctype="multipart/form-data"> | |
| <%= upyun_form_input_tag(:return_url => new_post_path) %> | |
| <input type="file" name="file" /> | |
| <button type="submit">上传图片</button> | |
| </form> |
| class CompressedRequests | |
| def initialize(app) | |
| @app = app | |
| end | |
| def method_handled?(env) | |
| !!(env['REQUEST_METHOD'] =~ /(POST|PUT)/) | |
| end | |
| def encoding_handled?(env) |