Skip to content

Instantly share code, notes, and snippets.

View edavis10's full-sized avatar

Eric Davis edavis10

View GitHub Profile
class StaleObject
include Redmine::I18n
include ERB::Util
attr_accessor :attributes
attr_accessor :changes
def initialize(stale_object)
raise ArgumentError.new("Call with an ActiveRecord object") unless stale_object.respond_to?(:attributes)
@attributes = stale_object.attributes.dup
end
@edavis10
edavis10 / developer-position.txt
Created December 8, 2009 17:34
Developer position in Portland, OR
I friend contacted me about a position opening at their startup. They'd prefer someone local to Portland, OR (USA) but are flexible. If you're interested, contact Tony McCormick: tony [AT] mi-squared [DOT] com and mention that you heard it from me (Eric Davis).
----------
Wanted:
Looking for someone that is technically savvy, a quick learner and thinks that business application development, particularly medical records software is really cool. And can deal with a startup.
The pay is $25/hr max for now, so a new college grad (of any age) looking for a opportunity to learn this business is best.
diff --git a/app/models/project.rb b/app/models/project.rb
index b97d365..d4a5508 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -389,7 +389,9 @@ class Project < ActiveRecord::Base
# remove disabled modules
enabled_modules.each {|mod| mod.destroy unless module_names.include?(mod.name)}
# add new modules
- module_names.each {|name| enabled_modules << EnabledModule.new(:name => name)}
+ module_names.each do |name|
grouped_by_role = {}
members.each do |member|
member.roles.each do |role|
my_data[role] ||= []
my_data[role] << member.user
end
end
return grouped_by_role
@edavis10
edavis10 / update_issue_created_on.rb
Created November 10, 2009 16:39
Setting the created_on field
issue = Issue.find(100)
issue.created_on = 10.days.ago
issue.save
# Or if you wanted to "create" the issues based on their start_date
Issue.all.each do |issue|
issue.created_on = issue.start_date
issue.save
end
We couldn’t find that file to show.
@edavis10
edavis10 / Rakefile
Created November 6, 2009 02:50
My Jekyll Rakefile
task :default => :generate
desc "Generate using jekyll"
task :generate do
sh "jekyll"
end
desc "Auto generate using jekyll"
task :auto do
sh "jekyll --auto"
@edavis10
edavis10 / _config.yml
Created November 6, 2009 02:18
Pagination in Jekyll
# ....other stuff here
paginate: 10
<h3 class="content">Related articles</h3>
<ul class="related">
{% for post in site.related_posts limit:5 %}
<li><a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
@edavis10
edavis10 / source_user.rb
Created November 4, 2009 03:36
Rails configuration for using two different databases.
class SourceUser < ActiveRecord::Base
include SecondDatabase
set_table_name :users
end