Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Xilinx and VHDL

Chad Bearden chadb

💭
Xilinx and VHDL
  • Jacksonville, FL
View GitHub Profile
@chadb
chadb / bash alias
Created Feb 11, 2014
Git what did I do lastweek?
View bash alias
alias lastweek='git log --author="`git config user.name`" --pretty=format:"%cd %h %s" --date=short --after={`chronic monday of last week`} --before={`chronic last sunday`}'
View gist:2479303
def self.pending_multi_deployment_ids( user, date = Time.zone.now.to_date )
end_date = date - user.off_cycle_delta
SurveyDeployment.select_ids.active.start_on_lte( date ).end_on_gte( end_date ).group_ids_in( user.group_ids ).multi.type_null.map(&:id)
end
def self.pending_single_deployment_ids( user, date = Time.zone.now.to_date )
end_date = date - user.off_cycle_delta
singles = SurveyDeployment.select_ids.active.single.start_on_lte( date ).end_on_gte( end_date ).group_ids_in( user.group_ids ).type_null
return [] if singles.empty?
taken = SurveyResponse.select_distinct_survey_deployment_ids.survey_deployment_ids_in( singles.map(&:id) ).user_id_is( user.id )
@chadb
chadb / basic_usage_role_group.rb
Created Jan 31, 2012
basic usage of role_group
View basic_usage_role_group.rb
fast_context "Basic Usage" do
setup do
@sy = Factory :school_year
@pgm = Factory :program
@rgn = Factory :region
@acct = Account.default
@rotation = Role.create! :name => 'Rotational Faculty', :school_year_required => true, :program_required => true, :region_required => true, :account => @acct
@grp = RoleGroup.create! :name => 'Pediatric', :role => @rotation, :account => @acct, :program => @pgm, :school_year => @sy, :region => @rgn
end