Skip to content

Instantly share code, notes, and snippets.

View chadb's full-sized avatar
💭
Xilinx and VHDL

Chad Bearden chadb

💭
Xilinx and VHDL
  • Jacksonville, FL
View GitHub Profile
@chadb
chadb / basic_usage_role_group.rb
Created January 31, 2012 13:46
basic usage of role_group
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
@chadb
chadb / gist:2479303
Created April 24, 2012 12:41
pending ids
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 / bash alias
Created February 11, 2014 20:39
Git what did I do lastweek?
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`}'