This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put it on your model instance | |
def column_for_attribute(name) | |
# Put your accessor name, in my case :value | |
if :value == name.to_sym | |
self.class.columns_hash[self.field.value_column.to_s] | |
else | |
self.class.columns_hash[name.to_s] | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Put this in your .gitconfig file under the alias section | |
orphank = !gitk --all `git reflog | cut -c1-7`& | |
# Then run it by typing 'git orphank' on the command line. | |
# A text version of the same is | |
orphanl = !git --pretty=oneline --abbrev-commit --graph --decorate `git reflog | cut -c1-7` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NOTICE: to get Nginx+Unicorn best-practices configuration see the gist https://gist.github.com/3052776 | |
$ cd /usr/src | |
$ wget http://nginx.org/download/nginx-1.2.1.tar.gz | |
$ tar xzvf ./nginx-1.2.1.tar.gz && rm -f ./nginx-1.2.1.tar.gz | |
$ wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.30.tar.gz | |
$ tar xzvf pcre-8.30.tar.gz && rm -f ./pcre-8.30.tar.gz | |
$ wget http://www.openssl.org/source/openssl-1.0.1c.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ActiveRecord::Associations::ClassMethods::JoinDependency::JoinAssociation | |
# has_many and has_one through belongs_to are broken becuase the order of the primary key | |
# and foreign table key need to be reversed. this detects and fixes it. | |
def association_join_with_through_belongs_to_fix | |
join = association_join_without_through_belongs_to_fix | |
if [:has_many, :has_one].include?(reflection.macro) && reflection.options[:through] && source_reflection.macro == :belongs_to | |
connection = reflection.active_record.connection | |
parent_table_name = connection.quote_table_name(parent.aliased_table_name) | |
parent_key = connection.quote_column_name(parent.primary_key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://blog.vuzit.com/2008/08/01/paypal-website-payments-pro-us-with-recurring-billing-and-activemerchant/ | |
# The MIT License | |
# | |
# Copyright (c) 2008 Vuzit.com, Chris Cera, Tobias Luetke | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
NewerOlder