Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rojotek's full-sized avatar

Rob Dawson rojotek

  • ConsenSys
  • Australia
View GitHub Profile
@rojotek
rojotek / cla.txt
Last active September 5, 2020 08:45
ConsenSys Apache 2 based CLA
ConsenSys Software Inc
Individual Contributor License Agreement ("Agreement") V2.0
http://www.apache.org/licenses/
Thank you for your interest in ConsenSys Software Inc (ConsenSys).
In order to clarify the intellectual property license
granted with Contributions from any person or entity, ConsenSys
must have a Contributor License Agreement ("CLA") on file that has
been signed by each Contributor, indicating agreement to the license
terms below. This license is for your protection as a Contributor as
curl https://%ES-SERVER:PORT%/_nodes/stats/thread_pool |jq '.nodes |to_entries[].value.thread_pool.bulk'
@rojotek
rojotek / concepts-member-operation.rb
Created May 26, 2016 05:51
Trailblazer Operations
class Member::Index < Trailblazer::Operation
attr_reader :members
def process(params)
office = Office::Show.(params.merge(id: params[:office_id])).office
@members = office.office_members
end
end
# more stuff that extends from Member::Index
@rojotek
rojotek / migration.rb
Created September 7, 2014 22:48
rails models in migrations
class ModelClass < ActiveRecord::Base
attr_protected
end
def up
ModelClass.reset_column_information
end
@rojotek
rojotek / has_one_final.rb
Created May 15, 2014 21:58
Final has_one code
class Employee
belongs_to: :department
has_one :organization, through: :department
end
class Departmet
belongs_to :organization
has_many :project_departments
has_many :projects, through: :project_departments
has_many :employees
@rojotek
rojotek / project.rb
Created May 15, 2014 21:55
rails has_one with a proc.
class Project
# as above
has_one :project_department, ->(department) { where department: department }, class_name: 'ProjectDepartment'
end
@rojotek
rojotek / project_department.rb
Created May 15, 2014 21:54
has_many through
class Project
has_many :project_departments
has_many :departments, through: :project_departments
end
class ProjectDepartment
belongs_to :project
belongs_to :project
end
@rojotek
rojotek / employee.rb
Created May 15, 2014 21:53
has_one :through
class Employee
belongs_to: :department
has_one :organization, through: :department
end
@rojotek
rojotek / gist:1a9ce6559bba979f69b7
Created May 15, 2014 21:51
belongs_to through
belongs_to :organization through: :department # Does not exist
@rojotek
rojotek / has_one_initial.rb
Created May 15, 2014 21:49
Simple model for has_one discussion.
class Employee
belongs_to: :department
end
class Departmet
belongs_to :organization
has_many :employees
end
class Organization