First install the required gems:
gem install octokit awesomeprint rainbowThen run it to extract all of your open GitHub issues into files (with comments).
ruby my-gh-issues.rb| # AR Object dup vs marshal benchmarks | |
| # | |
| # re: http://rails.lighthouseapp.com/projects/8994/tickets/785 | |
| # | |
| # user system total real | |
| # string saved in hash 0.060000 0.000000 0.060000 ( 0.051861) | |
| # string marshalling 0.630000 0.000000 0.630000 ( 0.643304) | |
| # | |
| # object saved in hash 0.060000 0.000000 0.060000 ( 0.052789) | |
| # object marshalling 7.020000 0.030000 7.050000 ( 7.073463) |
| class Tag | |
| has_many :taggings | |
| named_scope :important, :include => { :taggings => :important } | |
| end | |
| class Tagging | |
| belongs_to :tag | |
| belongs_to :posts | |
| # uses a string 'flag' column but could be changed to a boolean important |
| orders = {} | |
| all_orders.group_by(&:ItemCode).each do |item_code, code_orders| | |
| orders[item_code] = {} | |
| code_orders.group_by(&:year).each do |year, year_orders| | |
| orders[item_code][year] = {} | |
| year_orders.group_by(&:month).each do |month, month_orders| | |
| orders[item_code][year][month] = month_orders.first.quantity | |
| end | |
| orders[item_code][year]["total"] = orders[item_code][year].values.map(&:to_f).sum | |
| end |
| def morse s;26.times{|i|s.gsub! /#{(97+i).chr}/i,("$be5 J8G#T6P'&9Sl/,!-H0cfk"[i]-31).to_s(3).tr("12",".-")};s;end |
First install the required gems:
gem install octokit awesomeprint rainbowThen run it to extract all of your open GitHub issues into files (with comments).
ruby my-gh-issues.rb| require 'test_helper' | |
| require 'clearance/testing' | |
| class EmployeesControllerTest < ActionController::TestCase | |
| test "an ASM can not create a user" do | |
| sign_in | |
| assert_raise CanCan::AccessDenied do | |
| post :create, :employee => { :name => 'Feed Store' } | |
| end |
This example is not my real app, but it's modeled pretty closely to it.
My mom schedules a couple hundred employees at a local warehouse. In their system, a worker can earn "points" for being late or missing shifts. Here we have a sort of summary screen for my mom, who may need to follow up with new employees or discipline employees with concerning levels of points.
Questions that arise as I code something like this: