Skip to content

Instantly share code, notes, and snippets.

Rob Dawson rojotek

Block or report user

Report or block rojotek

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rojotek
rojotek / cla.txt
Last active Dec 11, 2018
ConsenSys Apache 2 based CLA
View cla.txt
ConsenSys AG
Individual Contributor License Agreement ("Agreement") V2.0
http://www.apache.org/licenses/
Thank you for your interest in ConsenSys AG (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
View gist:f1e79d9fb450ac9824e252b20e7f8081
curl https://%ES-SERVER:PORT%/_nodes/stats/thread_pool |jq '.nodes |to_entries[].value.thread_pool.bulk'
View concepts-member-operation.rb
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 Sep 7, 2014
rails models in migrations
View migration.rb
class ModelClass < ActiveRecord::Base
attr_protected
end
def up
ModelClass.reset_column_information
end
@rojotek
rojotek / has_one_final.rb
Created May 15, 2014
Final has_one code
View has_one_final.rb
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
rails has_one with a proc.
View project.rb
class Project
# as above
has_one :project_department, ->(department) { where department: department }, class_name: 'ProjectDepartment'
end
View project_department.rb
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
has_one :through
View employee.rb
class Employee
belongs_to: :department
has_one :organization, through: :department
end
View gist:1a9ce6559bba979f69b7
belongs_to :organization through: :department # Does not exist
@rojotek
rojotek / has_one_initial.rb
Created May 15, 2014
Simple model for has_one discussion.
View has_one_initial.rb
class Employee
belongs_to: :department
end
class Departmet
belongs_to :organization
has_many :employees
end
class Organization
You can’t perform that action at this time.