Skip to content

Instantly share code, notes, and snippets.

View jgarber's full-sized avatar

Jason Garber jgarber

View GitHub Profile
This was just a branch off of master. We're not using the Federated path,
but we are using SSO (it'd be nice if we could make this a separate setting)
"""Logs a user in using a token from Keystone's POST."""
referer = request.META.get('HTTP_REFERER')
auth_url = re.sub(r'/auth.*', '', referer)
- request.federated_login = True
+ request.federated_login = False
request.user = auth.authenticate(request=request, auth_url=auth_url)
namespace :bundle do
def intersection
return @outdated if @outdated
@outdated = `bundle outdated`
@outdated = @outdated.split("\n").select{|line| line.include?("*")}
@outdated ={|gem| gem.match(/\* ([a-zA-Z0-9_-]+) /)[1]}
app_gems = File.readlines("Gemfile").select{|line| line.include?("gem ")}
app_gems ={|gem| gem.match(/gem '([a-zA-Z0-9_-]+)/)[1]}
jgarber / gist:3833029
Created October 4, 2012 11:21 — forked from prathe/gist:1628799
BigDecimal#to_s without trailing zero
class BigDecimalWithoutTrailingZeroes < BigDecimal
def to_digits
_, significant_digits, _, exponent = split
if zero?
elsif exponent >= significant_digits.size