Skip to content

Instantly share code, notes, and snippets.

View diminish7's full-sized avatar

Jason Rush diminish7

View GitHub Profile
@diminish7
diminish7 / gist:8947190
Created February 12, 2014 00:07
NMatrix Compilation Output
deploy@web:~/nmatrix$ bundle exec rake compile
Your Gemfile lists the gem pry (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem rspec-longrun (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
mkdir -p tmp/x86_64-linux/nmatrix/2.1.0
cd tmp/x86_64-linux/nmatrix/2.1.0
/usr/local/rvm/rubies/ruby-2.1.0/bin/ruby -I. ../../../../ext/nmatrix/extconf.rb
@diminish7
diminish7 / keybase.md
Created March 21, 2014 17:56
keybase.md

Keybase proof

I hereby claim:

  • I am diminish7 on github.
  • I am diminish7 (https://keybase.io/diminish7) on keybase.
  • I have a public key whose fingerprint is E1AF 2FE0 04F9 4968 02D7 7C53 C8A8 DB5E C50A F9B8

To claim this, I am signing this object:

@diminish7
diminish7 / build_association.rb
Created April 18, 2012 18:33
Proposed change to build_association
# Returns a new, unsaved instance of the associated class. +options+ will
# be passed to the class's constructor.
def build_association(*options, &block)
if options.first.is_a?(Hash) && (subclass_name = options.first.with_indifferent_access[klass.inheritance_column]).present?
begin
subclass = klass.module_eval { compute_type(subclass_name) }
raise NameError unless (subclass == klass || subclass.ancestors.include?(klass))
subclass.new(*options, &block)
rescue NameError
raise ActiveRecord::SubclassNotFound.new("Invalid single-table inheritance type: #{subclass_name} is not a subclass of #{klass.name}")
@diminish7
diminish7 / authentication_tokens_controller.rb
Created October 11, 2012 16:46
Devise Token Auth for API
class AuthenticationTokensController < BaseApiController
skip_before_filter :authenticate_user!, only: :create
def create
resource = User.find_for_database_authentication(login: params[:login])
if resource && resource.valid_password?(params[:password])
resource.reset_authentication_token
resource.save(validate: false)
render :json => successful_json_with_user_information(resource)