Skip to content

Instantly share code, notes, and snippets.

View gaganawhad's full-sized avatar

Gagan Awhad gaganawhad

  • Desiring God
  • Minneapolis, MN
View GitHub Profile
@gaganawhad
gaganawhad / passenger-nginx-font-accept-header.md
Last active January 22, 2016 04:16 — forked from atiw003/nginx-font-serving
Setting Accept-Control-Allow--Origin header on ( font ) assets in nginx. Helpful when using passenger on heroku

Currently passenger 4.0.39 and above come with a default nginx configuration file with a location @static_assets block. Paste the following inside it.

  if ($request_filename ~* ^.*?/([^/]*?)$) {
      set $filename $1; 
   }

  if ($filename ~* ^.*?\.(eot)|(ttf)|(svg)|(woff)$) {
    add_header Access-Control-Allow-Origin *;
  }
@gaganawhad
gaganawhad / rubocop_pre_commit_hook
Last active August 29, 2015 14:26 — forked from mpeteuil/rubocop_pre_commit_hook
Ruby style guide git pre-commit hook using Rubocop as the style guide checker. Only runs on staged ruby files that have been added and/or modified.
#!/usr/bin/env ruby
require 'english'
require 'rubocop'
require 'byebug'
ADDED_OR_MODIFIED = /A|AM|^M/.freeze
changed_files = `git status --porcelain`.split(/\n/).
select { |file_name_with_status|