Skip to content

Instantly share code, notes, and snippets.


Andy Jeffries andyjeffries

View GitHub Profile
andyjeffries / output
Created Apr 15, 2020
Traefik real IP not working
View output
$ curl ⎈ |prod:default
GET / HTTP/1.1
User-Agent: curl/7.64.1
Accept: */*
X-Forwarded-Port: 80
X-Forwarded-Proto: http
X-Forwarded-Server: traefik-65bccdc4bd-tkbmn
andyjeffries /
Last active Nov 14, 2019
How to setup debugging with Ruby on Rails on VS Code

Debugging Ruby on Rails with VS Code

  1. Add to your Gemfile and bundle install --binstubs (then run rails app:update:bin to fix bundler overwriting Rails 5 default bin stub).
group :development do
  gem 'ruby-debug-ide'
  gem 'debase'

  # If you want some nice documentation, 
andyjeffries / cloudSettings
Last active Nov 20, 2020
Visual Studio Code Settings Sync Gist
View cloudSettings
andyjeffries /
Created Apr 11, 2018 — forked from albertbori/
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac


This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.


  • Mac OSX 10+
  • Administrator privileges
andyjeffries / .rails-template.rb
Created Apr 4, 2017
My Rails template to setup RSpec and Guard and Dokku integration
View .rails-template.rb
# Add to the given file the given lines, after the line with the given text, or replace the content
def add_to_file(path, text, after=nil, replace=false)
lines = []
if replace
lines = text
File.readlines(path).each do |line|
if after != nil and line.include?(after)
lines << line
lines << text
andyjeffries / .railsrc
Created Apr 4, 2017
My .railsrc to disable CoffeeScript and Turbolinks
View .railsrc
andyjeffries / loc.rb
Last active Jan 20, 2017
Lines of code
View loc.rb
def count_lines(filename, type)
lines ='BINARY').split("\n")
lines.delete_if {|line| line[/^\s*$/]}
case type
when :ruby
lines.delete_if {|line| line[/^\s*#/]}
when :go
lines.delete_if {|line| line[/^\s*\/\/$/]}
andyjeffries / example.rb
Created May 6, 2015
Example ARC for Abel
View example.rb
require "faraday"
class Customer < ActiveRestClient::Base
base_url ""
ActiveRestClient::Base.faraday_config do |faraday|
faraday.options.timeout = 20
faraday.headers['User-Agent'] = "ActiveRestClient/#{ActiveRestClient::VERSION}"
andyjeffries / Gemfile
Created Jun 16, 2014
Rails 4.1 Default Files
View Gemfile
source ''
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
andyjeffries / user.rb
Created May 3, 2014
ARC before_filter example for David Tolsma
View user.rb
class User < ActiveRestClient::Base
before_filter do |name, request|
request.headers["Authorization"] = request.get_params[:authorization]
get :find, "/users/:id"