Skip to content

Instantly share code, notes, and snippets.

View graysonchen's full-sized avatar

Grayson Chen graysonchen

View GitHub Profile
@graysonchen
graysonchen / nginx.conf
Created September 11, 2018 12:19 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@graysonchen
graysonchen / rails-api-template.rb
Created April 16, 2019 14:56 — forked from DotHide/rails-api-template.rb
Rails 5 API Application Template
require 'erb'
require 'ostruct'
# ====================
# 0. Helper
# ====================
def render_file(text, variables)
struct = OpenStruct.new(variables)
rendered_file = ERB.new(text).result(struct.instance_eval { binding })