Skip to content

Instantly share code, notes, and snippets.

@shivabhusal
Last active December 30, 2018 05:55
Show Gist options
  • Save shivabhusal/1154dee43b53d057daf508534feaccb5 to your computer and use it in GitHub Desktop.
Save shivabhusal/1154dee43b53d057daf508534feaccb5 to your computer and use it in GitHub Desktop.
Visual Studio Code Settings Sync Gist
{
"version": 2,
"clips": [
{
"value": "Date.yesterday.to_s",
"createdAt": 1546148589178,
"copyCount": 1,
"useCount": 0,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 41,
"character": 42
},
"end": {
"line": 41,
"character": 61
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/customer_allocations_controller_spec.rb"
}
},
{
"value": "Date.today.to_s",
"createdAt": 1546148369220,
"copyCount": 2,
"useCount": 3,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 5,
"character": 36
},
"end": {
"line": 5,
"character": 51
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/worker_allocations_controller_spec.rb"
}
},
{
"value": "tomorrow",
"createdAt": 1546148430728,
"copyCount": 2,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 38,
"character": 43
},
"end": {
"line": 38,
"character": 51
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/resource_allocations_controller_spec.rb"
}
},
{
"value": ":day => \\[String/Integer\\] mon,tue,\\.\\.sat,sun \\[any one of them\\]",
"createdAt": 1546148210299,
"copyCount": 1,
"useCount": 0,
"language": "markdown",
"createdLocation": {
"range": {
"start": {
"line": 66,
"character": 8
},
"end": {
"line": 66,
"character": 79
}
},
"uri": "file:///home/john/projects/business/README.md"
}
},
{
"value": "t.date :day",
"createdAt": 1546146978952,
"copyCount": 1,
"useCount": 0,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 6
},
"end": {
"line": 3,
"character": 17
}
},
"uri": "file:///home/john/projects/business/db/migrate/20181227122155_create_daily_task_allocation.rb"
}
},
{
"value": "class Api::V1::AllocationsController < Api::V1::ApiController\n before_action :set_allocation, except: %i[index create]\n\n def index\n respond_with klass.all\n end\n\n def create\n @allocation = klass.create(allocation_params)\n render json: @allocation\n end\n\n def show\n render json: @allocation\n end\n\n def update\n render json: @allocation.update(allocation_params)\n end\n\n def destroy\n render json: @allocation.destroy\n end\n\n private\n\n def set_allocation\n @allocation = klass.find(params[:id])\n end\nend\n",
"createdAt": 1546083799929,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 30,
"character": 0
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "render json:",
"createdAt": 1546083491730,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 9,
"character": 4
},
"end": {
"line": 9,
"character": 16
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "respond_to :json",
"createdAt": 1545998962088,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 2
},
"end": {
"line": 2,
"character": 2
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/schedules_controller.rb"
}
},
{
"value": "\n def allocation_params\n params.permit(:day, :worker_id, :time_slot, :availability)\n end",
"createdAt": 1546082288769,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 29,
"character": 0
},
"end": {
"line": 29,
"character": 0
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "@allocation.destroy",
"createdAt": 1546081451916,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 21,
"character": 4
},
"end": {
"line": 21,
"character": 4
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "worker_allocation",
"createdAt": 1546078367346,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 5,
"character": 12
},
"end": {
"line": 5,
"character": 29
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/resource_allocations_controller_spec.rb"
}
},
{
"value": "let!(:worker) { create :worker }\n let!(:wa1) do\n create :worker_allocation, day: 'tue', worker: worker,\n time_slot: 12, availability: 'free'\n end\n\n let!(:wa2) do\n create :worker_allocation, day: 'wed', worker: worker,\n time_slot: 12, availability: 'free'\n end\n\n let(:body) { JSON.parse(response.body) }\n\n describe 'GET index' do\n context '200' do\n it 'should return all the worker associations' do\n get :index\n expect(response.status).to eq(200)\n expect(body['data'].map { |x| x['id'] }).to match_array([wa1.id.to_s, wa2.id.to_s])\n end\n end\n end\n\n describe 'GET show' do\n context '200' do\n it 'should return all the worker associations' do\n get :show, id: wa1.id\n expect(response.status).to eq(200)\n expect(body['data']['id']).to eq(wa1.id.to_s)\n end\n end\n end\n\n describe 'PATCH update' do\n context '200' do\n it 'should return all the worker associations' do\n get :update, id: wa1.id, day: 'mon', time_slot: 34\n expect(response.status).to eq(200)\n expect(wa1.reload.day).to eq('mon')\n expect(wa1.reload.time_slot).to eq(34)\n end\n end\n end\n\n describe 'DELETE destroy' do\n context '200' do\n it 'should return all the worker associations' do\n get :destroy, id: wa1.id\n expect(response.status).to eq(200)\n expect { wa1.reload }.to raise_error { ActiveRecord::RecordNotFound }\n end\n end\n end",
"createdAt": 1546078349635,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 2
},
"end": {
"line": 55,
"character": 5
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/worker_allocations_controller_spec.rb"
}
},
{
"value": "customer_allocation",
"createdAt": 1546078297542,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 5,
"character": 12
},
"end": {
"line": 5,
"character": 31
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/worker_allocations_controller_spec.rb"
}
},
{
"value": "let!(:customer) { create :customer }\n let!(:ca1) do\n create :customer_allocation, day: :sun, customer: customer,\n time_slot: 12, availability: 'free'\n end\n\n let!(:ca2) do\n create :customer_allocation, day: :sun, customer: customer,\n time_slot: 12, availability: 'free'\n end\n\n let(:body) { JSON.parse(response.body) }\n\n describe 'GET index' do\n context '200' do\n it 'should return all the customer associations' do\n get :index\n expect(response.status).to eq(200)\n expect(body['data'].map { |x| x['id'] }).to match_array([ca1.id.to_s, ca2.id.to_s])\n end\n end\n end\n\n describe 'GET show' do\n context '200' do\n it 'should return all the customer associations' do\n get :show, id: ca1.id\n expect(response.status).to eq(200)\n expect(body['data']['id']).to eq(ca1.id.to_s)\n end\n end\n end\n\n describe 'PATCH update' do\n context '200' do\n it 'should return all the customer associations' do\n get :update, id: ca1.id, day: 'mon', time_slot: 34\n expect(response.status).to eq(200)\n expect(ca1.reload.day).to eq('mon')\n expect(ca1.reload.time_slot).to eq(34)\n end\n end\n end\n\n describe 'DELETE destroy' do\n context '200' do\n it 'should return all the customer associations' do\n get :destroy, id: ca1.id\n expect(response.status).to eq(200)\n expect { ca1.reload }.to raise_error { ActiveRecord::RecordNotFound }\n end\n end\n end",
"createdAt": 1546078226580,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 2
},
"end": {
"line": 55,
"character": 5
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/customer_allocations_controller_spec.rb"
}
},
{
"value": " binding.pry\n",
"createdAt": 1546055130508,
"copyCount": 4,
"useCount": 4,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 7,
"character": 0
},
"end": {
"line": 7,
"character": 0
}
},
"uri": "file:///home/john/projects/business/spec/acceptance/resources_controller_spec.rb"
}
},
{
"value": "da1.reload.day",
"createdAt": 1546078121876,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 40,
"character": 15
},
"end": {
"line": 40,
"character": 29
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/daily_task_allocations_controller_spec.rb"
}
},
{
"value": ", day: Date.today",
"createdAt": 1546077657605,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 5,
"character": 33
},
"end": {
"line": 5,
"character": 50
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/daily_task_allocations_controller_spec.rb"
}
},
{
"value": "let!(:customer) { create :customer }\n let!(:ca1) do\n create :customer_allocation, day: :sun, customer: customer,\n time_slot: 12, availability: 'free'\n end\n\n let!(:ca2) do\n create :customer_allocation, day: :sun, customer: customer,\n time_slot: 12, availability: 'free'\n end\n \n let(:body) { JSON.parse(response.body) }\n\n describe 'GET index' do\n context '200' do\n it 'should return all the customer associations' do\n get :index\n expect(response.status).to eq(200)\n expect(body['data'].map { |x| x['id'] }).to match_array([ca1.id.to_s, ca2.id.to_s])\n end\n end\n end\n\n describe 'GET show' do\n context '200' do\n it 'should return all the customer associations' do\n get :show, id: ca1.id\n expect(response.status).to eq(200)\n expect(body['data']['id']).to eq(ca1.id.to_s)\n end\n end\n end\n\n describe 'PATCH update' do\n context '200' do\n it 'should return all the customer associations' do\n get :update, id: ca1.id, day: 'mon', time_slot: 34\n expect(response.status).to eq(200)\n expect(ca1.reload.day).to eq('mon')\n expect(ca1.reload.time_slot).to eq(34)\n end\n end\n end\n\n describe 'DELETE destroy' do\n context '200' do\n it 'should return all the customer associations' do\n get :destroy, id: ca1.id\n expect(response.status).to eq(200)\n expect{ca1.reload}.to raise_error{ActiveRecord::RecordNotFound}\n end\n end\n end",
"createdAt": 1546075619475,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 2
},
"end": {
"line": 55,
"character": 5
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/customer_allocations_controller_spec.rb"
}
},
{
"value": "let!(:customer) { create :customer }\n let!(:ca1) do\n create :customer_allocation, day: :sun, customer: customer,\n time_slot: 12, availability: 'free'\n end\n\n let!(:ca2) do\n create :customer_allocation, day: :sun, customer: customer,\n time_slot: 12, availability: 'free'\n end\n \n let(:body) { JSON.parse(response.body) }\n\n describe 'GET index' do\n context '200' do\n it 'should return all the customer associations' do\n get :index\n expect(response.status).to eq(200)\n expect(body['data'].map { |x| x['id'] }).to match_array([ca1.id.to_s, ca2.id.to_s])\n end\n end\n end\n\n describe 'GET show' do\n context '200' do\n it 'should return all the customer associations' do\n get :show, id: ca1.id\n expect(response.status).to eq(200)\n expect(body['data']['id']).to eq(ca1.id.to_s)\n end\n end\n end",
"createdAt": 1546075311743,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 2
},
"end": {
"line": 34,
"character": 5
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/customer_allocations_controller_spec.rb"
}
},
{
"value": "\n describe 'GET index' do\n context '200' do\n it 'should return all the customer associations' do\n get :index\n expect(response.status).to eq(200)\n expect(body['data'].map { |x| x['id'] }).to match_array([ca1.id.to_s, ca2.id.to_s])\n end\n end\n end",
"createdAt": 1546075148480,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 15,
"character": 0
},
"end": {
"line": 24,
"character": 5
}
},
"uri": "file:///home/john/projects/business/spec/controllers/api/automation/customer_allocations_controller_spec.rb"
}
},
{
"value": "\n private\n \n def klass\n Klass\n end",
"createdAt": 1546072882985,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 2
},
"end": {
"line": 7,
"character": 7
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/customer_allocations_controller.rb"
}
},
{
"value": "\n def klass\n Klass\n end",
"createdAt": 1546069893118,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 0
},
"end": {
"line": 5,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/customer_allocations_controller.rb"
}
},
{
"value": "CustomerAllocation",
"createdAt": 1546069788255,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 10
},
"end": {
"line": 1,
"character": 28
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/customer_allocations_controller.rb"
}
},
{
"value": "remove_foreign_key :users, name: \"fk_users_organizations\"",
"createdAt": 1546063410035,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 4
},
"end": {
"line": 3,
"character": 61
}
},
"uri": "file:///home/john/projects/business/db/migrate/20181211212450_remove_foreign_key_constraint_betweek_user_n_organization.rb"
}
},
{
"value": "Api::V1::ApiController",
"createdAt": 1545998914448,
"copyCount": 3,
"useCount": 3,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 37
},
"end": {
"line": 0,
"character": 59
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/schedules_controller.rb"
}
},
{
"value": "#### Params for POST and PUT/PATCH REQUESTs\n :day => [String/Integer] mon,tue,..sat,sun [any one of them]\n :worker_id => Integer [ForeignKey] \n :time_slot => Integer\n :availability => [String/Integer] {free: 1, allocated: 0}\n\n",
"createdAt": 1546062532557,
"copyCount": 1,
"useCount": 1,
"language": "markdown",
"createdLocation": {
"range": {
"start": {
"line": 65,
"character": 0
},
"end": {
"line": 71,
"character": 0
}
},
"uri": "file:///home/john/projects/business/README.md"
}
},
{
"value": "Allocation",
"createdAt": 1546059342672,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 20
},
"end": {
"line": 0,
"character": 30
}
},
"uri": "file:///home/john/projects/business/db/migrate/20181227122513_create_customer_allocation.rb"
}
},
{
"value": "DailyTaskAllocation",
"createdAt": 1546000408385,
"copyCount": 3,
"useCount": 3,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 16,
"character": 6
},
"end": {
"line": 16,
"character": 25
}
},
"uri": "file:///home/john/projects/business/app/models/automation/daily_task_allocation.rb"
}
},
{
"value": "include AllocationBasics",
"createdAt": 1546058921659,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 14,
"character": 2
},
"end": {
"line": 14,
"character": 26
}
},
"uri": "file:///home/john/projects/business/app/models/automation/customer_allocation.rb"
}
},
{
"value": "AllocationBasics",
"createdAt": 1546058736421,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 17,
"character": 0
},
"end": {
"line": 17,
"character": 0
}
},
"uri": "file:///home/john/projects/business/app/models/automation/resource_allocation.rb"
}
},
{
"value": "\n\n enum availability: {free: 1, allocated: 0}\n\n enum day: { mon: 0,\n tue: 1,\n wed: 2,\n thu: 3,\n fri: 4,\n sat: 5,\n sun: 6 }",
"createdAt": 1546058725897,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 14,
"character": 21
},
"end": {
"line": 14,
"character": 21
}
},
"uri": "file:///home/john/projects/business/app/models/automation/resource_allocation.rb"
}
},
{
"value": "\n enum day: { mon: 0,\n tue: 1,\n wed: 2,\n thu: 3,\n fri: 4,\n sat: 5,\n sun: 6 }",
"createdAt": 1546058677307,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 18,
"character": 0
},
"end": {
"line": 25,
"character": 22
}
},
"uri": "file:///home/john/projects/business/app/models/availability.rb"
}
},
{
"value": " {free: 1, allocated: 0}",
"createdAt": 1546058646911,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 16,
"character": 20
},
"end": {
"line": 16,
"character": 44
}
},
"uri": "file:///home/john/projects/business/app/models/automation/customer_allocation.rb"
}
},
{
"value": ":day, :worker_id, :time_slot, :availability",
"createdAt": 1546000610060,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 29,
"character": 5
},
"end": {
"line": 29,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "\n### Resources \n api_v1_resources GET /api/v1/resources(.:format) api/v1/resources#index\n api_v1_resource GET /api/v1/resources/:id(.:format) api/v1/resources#show\n",
"createdAt": 1546058058422,
"copyCount": 1,
"useCount": 1,
"language": "markdown",
"createdLocation": {
"range": {
"start": {
"line": 94,
"character": 0
},
"end": {
"line": 94,
"character": 0
}
},
"uri": "file:///home/john/projects/business/README.md"
}
},
{
"value": "show",
"createdAt": 1546057810782,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 18,
"character": 72
},
"end": {
"line": 18,
"character": 102
}
},
"uri": "file:///home/john/projects/business/config/routes/api_v1.rb"
}
},
{
"value": " %i[index update destroy show]",
"createdAt": 1546057797769,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 18,
"character": 72
},
"end": {
"line": 18,
"character": 102
}
},
"uri": "file:///home/john/projects/business/config/routes/api_v1.rb"
}
},
{
"value": "\n api_v1_customer_availabilities GET /api/v1/customers/:customer_id/availabilities(.:format) api/v1/availabilities#index",
"createdAt": 1546057108822,
"copyCount": 1,
"useCount": 1,
"language": "markdown",
"createdLocation": {
"range": {
"start": {
"line": 61,
"character": 137
},
"end": {
"line": 62,
"character": 142
}
},
"uri": "file:///home/john/projects/business/README.md"
}
},
{
"value": ", only: [] ",
"createdAt": 1546056478848,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 36,
"character": 20
},
"end": {
"line": 36,
"character": 31
}
},
"uri": "file:///home/john/projects/business/config/routes/api_v1.rb"
}
},
{
"value": " binding.pry\n",
"createdAt": 1546054206817,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 0
},
"end": {
"line": 2,
"character": 0
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/resources_controller.rb"
}
},
{
"value": "gem 'puma'\n",
"createdAt": 1546051055049,
"copyCount": 1,
"useCount": 1,
"language": "gemfile",
"createdLocation": {
"range": {
"start": {
"line": 7,
"character": 0
},
"end": {
"line": 7,
"character": 0
}
},
"uri": "file:///home/john/projects/business/Gemfile"
}
},
{
"value": "ActionController::Base",
"createdAt": 1546050046153,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 30
},
"end": {
"line": 2,
"character": 52
}
},
"uri": "file:///home/john/projects/business/app/controllers/application_controller.rb"
}
},
{
"value": "/api/v1/customers/allocations",
"createdAt": 1546012717915,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 35,
"character": 3
},
"end": {
"line": 35,
"character": 3
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "20181227122155",
"createdAt": 1546011492493,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 8,
"character": 28
},
"end": {
"line": 8,
"character": 28
}
},
"uri": "file:///home/john/projects/business/db/migrate/20181227122155_create_task_matrices.rb"
}
},
{
"value": "20181228082054",
"createdAt": 1546011500494,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 8,
"character": 28
},
"end": {
"line": 8,
"character": 28
}
},
"uri": "file:///home/john/projects/business/db/migrate/20181227122155_create_task_matrices.rb"
}
},
{
"value": "preference",
"createdAt": 1546011002676,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 7,
"character": 3
},
"end": {
"line": 7,
"character": 13
}
},
"uri": "file:///home/john/projects/business/app/models/automation/task_type.rb"
}
},
{
"value": "# id :integer not null, primary key\n# name :string\n# type :integer\n# preference :integer\n# priority :integer\n# created_at :datetime not null\n# updated_at :datetime not null\n#",
"createdAt": 1546008893963,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 4,
"character": 0
},
"end": {
"line": 11,
"character": 1
}
},
"uri": "file:///home/john/projects/business/app/models/automation/task_type.rb"
}
},
{
"value": " attr = Vehicle.pluck(:id).map { |id| { manageable_id: id, manageable_type: 'Vehicle' } }\n Resource.create attr",
"createdAt": 1546002884169,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 3
},
"end": {
"line": 3,
"character": 24
}
},
"uri": "file:///home/john/projects/business/db/data/20181228131147_generate_resources.rb"
}
},
{
"value": "respond_with Resource.all.map(&:manageable)",
"createdAt": 1546003125256,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 2,
"character": 4
},
"end": {
"line": 2,
"character": 47
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/resources_controller.rb"
}
},
{
"value": "license_plate_number",
"createdAt": 1546003059403,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 5,
"character": 3
},
"end": {
"line": 5,
"character": 23
}
},
"uri": "file:///home/john/projects/business/app/models/vehicle.rb"
}
},
{
"value": " Resource.create attr",
"createdAt": 1546002901190,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 3
},
"end": {
"line": 3,
"character": 24
}
},
"uri": "file:///home/john/projects/business/db/data/20181228131147_generate_resources.rb"
}
},
{
"value": "manageable_id",
"createdAt": 1546002836122,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 5,
"character": 3
},
"end": {
"line": 5,
"character": 16
}
},
"uri": "file:///home/john/projects/business/app/models/automation/resource.rb"
}
},
{
"value": "before_action :set_allocation, except: %i[index create]\n \n def index\n respond_with ResourceAllocation.all\n end\n\n def create\n @allocation = ResourceAllocation.create(allocation_params)\n respond_with @allocation\n end\n\n def show\n respond_with @allocation\n end\n\n def update\n respond_with @allocation.update(allocation_params)\n end\n\n def delete\n @allocation.destroy\n respond_with @allocation\n end\n\n private\n\n def set_allocation\n @allocation = ResourceAllocation.find(params[:id])\n end\n\n def allocation_params\n params.permit(:day, :worker_id, :time_slot, :availability)\n end",
"createdAt": 1546000188517,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 33,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/resource_allocations_controller.rb"
}
},
{
"value": "hash = {\n 'customer_id'=> -> { @owner = Customer.find(params[:customer_id]) },\n 'worker_id'=> -> { @owner = Worker.find(params[:worker_id]) },\n 'resource_id'=> -> { @owner = vehicle.find(params[:resource_id]) }\n }",
"createdAt": 1546001840883,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 10,
"character": 4
},
"end": {
"line": 14,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/availabilities_controller.rb"
}
},
{
"value": "availabilities",
"createdAt": 1546001056025,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 15,
"character": 17
},
"end": {
"line": 15,
"character": 31
}
},
"uri": "file:///home/john/projects/business/config/routes/api_v1.rb"
}
},
{
"value": "AllocationsController",
"createdAt": 1546000281687,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 15
},
"end": {
"line": 0,
"character": 36
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": ", :day, :worker_id, :time_slot, :availability",
"createdAt": 1546000641382,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 16
},
"end": {
"line": 1,
"character": 61
}
},
"uri": "file:///home/john/projects/business/app/serializers/worker_allocation_serializer.rb"
}
},
{
"value": ":day, :task_name, :task_id, :user_id, :worker_id, :start_on, :complete_on",
"createdAt": 1546000531843,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 6,
"character": 18
},
"end": {
"line": 6,
"character": 91
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/daily_task_allocations_controller.rb"
}
},
{
"value": " Klass = ResourceAllocation",
"createdAt": 1546000306381,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 1
},
"end": {
"line": 1,
"character": 28
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/resource_allocations_controller.rb"
}
},
{
"value": "ResourceAllocation",
"createdAt": 1546000303091,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 15
},
"end": {
"line": 0,
"character": 33
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/resource_allocations_controller.rb"
}
},
{
"value": "Klass",
"createdAt": 1546000257554,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 4,
"character": 17
},
"end": {
"line": 4,
"character": 22
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/allocations_controller.rb"
}
},
{
"value": "before_action :set_allocation, except: %i[index create]\n \n def index\n respond_with WorkerAllocation.all\n end\n\n def create\n @allocation = WorkerAllocation.create(allocation_params)\n respond_with @allocation\n end\n\n def show\n respond_with @allocation\n end\n\n def update\n respond_with @allocation.update(allocation_params)\n end\n\n def delete\n @allocation.destroy\n respond_with @allocation\n end\n\n private\n\n def set_allocation\n @allocation = WorkerAllocation.find(params[:id])\n end\n\n def allocation_params\n params.permit(:day, :worker_id, :time_slot, :availability)\n end",
"createdAt": 1546000127914,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 33,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/worker_allocations_controller.rb"
}
},
{
"value": "respond_with @allocation",
"createdAt": 1546000040339,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 13,
"character": 4
},
"end": {
"line": 13,
"character": 28
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/worker_allocations_controller.rb"
}
},
{
"value": "before_action :set_allocation, except: %i[index create]\n \n def index\n respond_with WorkerAllocation.all\n end\n\n def create\n @allocation = WorkerAllocation.create(allocation_params)\n respond_with @allocation\n end\n\n def show\n respond_with @allocation\n end\n\n def update\n respond_with @allocation.update(allocation_params)\n end\n\n private\n\n def set_allocation\n @allocation = WorkerAllocation.find(params[:id])\n end\n\n def allocation_params\n params.permit(:day, :worker_id, :time_slot, :availability)\n end",
"createdAt": 1546000020312,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 2
},
"end": {
"line": 28,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/worker_allocations_controller.rb"
}
},
{
"value": "WorkerAllocation",
"createdAt": 1545999971647,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 3,
"character": 17
},
"end": {
"line": 3,
"character": 33
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/worker_allocations_controller.rb"
}
},
{
"value": "$flogger.puts 'Created availability', payload: avail",
"createdAt": 1545998163703,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 60,
"character": 10
},
"end": {
"line": 60,
"character": 62
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": " before_action :set_allocation, except: [:index]\n def index\n respond_with WorkerAllocation.all\n end\n\n def show\n respond_with @allocation\n end\n\n def update\n respond_with @allocation.update(allocation_params)\n end\n\n private\n\n def set_allocation\n @allocation = WorkerAllocation.find(params[:id])\n end\n\n def allocation_params\n params.permit(:day, :worker_id, :time_slot, :availability)\n end",
"createdAt": 1545999940826,
"copyCount": 2,
"useCount": 2,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 1,
"character": 1
},
"end": {
"line": 22,
"character": 5
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/worker_allocations_controller.rb"
}
},
{
"value": " WorkerAllocation.find(params[:id])",
"createdAt": 1545999559445,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 6,
"character": 16
},
"end": {
"line": 6,
"character": 16
}
},
"uri": "file:///home/john/projects/business/app/controllers/api/v1/worker_allocations_controller.rb"
}
},
{
"value": " avail = ",
"createdAt": 1545998170479,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 56,
"character": 9
},
"end": {
"line": 56,
"character": 18
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "avail",
"createdAt": 1545998142499,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 60,
"character": 55
},
"end": {
"line": 60,
"character": 60
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "GenerateAvailabilityData",
"createdAt": 1545997710672,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 6
},
"end": {
"line": 0,
"character": 30
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "class GenerateAvailabilityData < ActiveRecord::Migration\n def up\n for_customer\n for_worker\n end\n\n def down\n raise ActiveRecord::IrreversibleMigration\n end\n\n private\n\n def for_customer\n Customer.all.each do |customer|\n days_of_refuel = begin\n customer.subscription.day_of_refuel\n rescue StandardError\n []\n end\n # \"8:00PM - 5:00AM, 8:00PM - 5:00AM\"\n shifts = begin\n customer.subscription.preferences['time_of_refuel']\n rescue StandardError\n ''\n end.split(',')\n\n shifts.each do |shift|\n start_time, end_time = shift.split('-')\n days_of_refuel.each do |day_index|\n customer.availabilities.create start_on: start_time,\n end_on: end_time,\n best_start_on: start_time,\n best_end_on: end_time,\n day: day_index\n end\n end\n end\n end\n\n def for_worker\n # {\"mon\"=>0, \"tue\"=>1, \"wed\"=>2, \"thu\"=>3, \"fri\"=>4, \"sat\"=>5, \"sun\"=>6}\n days = Date::DAYS_INTO_WEEK.map { |x, i| [x.to_s[0..2], i] }.to_h\n Worker.all.each do |worker|\n avail_days = worker.days_available.split(',').map { |x| x[0..2] }\n days_of_refuel = days.slice(*avail_days).values\n # \"8:00PM - 5:00AM, 8:00PM - 5:00AM\"\n shifts = begin\n worker.time_available\n rescue StandardError\n ''\n end.split(',')\n\n shifts.each do |shift|\n start_time, end_time = shift.split('-')\n days_of_refuel.each do |day_index|\n worker.availabilities.create start_on: start_time,\n end_on: end_time,\n best_start_on: start_time,\n best_end_on: end_time,\n day: day_index\n end\n end\n end\n end\nend\n",
"createdAt": 1545997702666,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 0,
"character": 0
},
"end": {
"line": 65,
"character": 0
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "days = Date::DAYS_INTO_WEEK.map{|x,i|[x.to_s[0..2],i]}.to_h",
"createdAt": 1545997567410,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 41,
"character": 4
},
"end": {
"line": 41,
"character": 64
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "avail_days",
"createdAt": 1545997552396,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 43,
"character": 6
},
"end": {
"line": 43,
"character": 16
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "worker",
"createdAt": 1545996880574,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 41,
"character": 24
},
"end": {
"line": 41,
"character": 30
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "\n Customer.all.each do |customer|\n days_of_refuel = begin\n customer.subscription.day_of_refuel\n rescue StandardError\n []\n end\n # \"8:00PM - 5:00AM, 8:00PM - 5:00AM\"\n shifts = begin\n customer.subscription.preferences['time_of_refuel']\n rescue StandardError\n ''\n end.split(',')\n\n shifts.each do |shift|\n start_time, end_time = shift.split('-')\n days_of_refuel.each do |day_index|\n customer.availabilities.create start_on: start_time,\n end_on: end_time,\n best_start_on: start_time,\n best_end_on: end_time,\n day: day_index\n end\n end\n end",
"createdAt": 1545996786914,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 12,
"character": 18
},
"end": {
"line": 36,
"character": 7
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": "\n def for_worker\n end",
"createdAt": 1545996678190,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 15,
"character": 0
},
"end": {
"line": 17,
"character": 6
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
},
{
"value": " def for_customer\n \n end",
"createdAt": 1545996677138,
"copyCount": 1,
"useCount": 1,
"language": "ruby",
"createdLocation": {
"range": {
"start": {
"line": 17,
"character": 6
},
"end": {
"line": 17,
"character": 6
}
},
"uri": "file:///home/john/projects/business/db/data/20181228102431_generate_availability_data.rb"
}
}
]
}
{"lastUpload":"2018-12-30T05:55:25.790Z","extensionVersion":"v3.2.4"}
[
{
"metadata": {
"id": "c1f93252-67fa-4037-9624-4320bdb7d23d",
"publisherId": "EdgardMessias.clipboard-manager",
"publisherDisplayName": "EdgardMessias"
},
"name": "clipboard-manager",
"publisher": "EdgardMessias",
"version": "1.1.0"
},
{
"metadata": {
"id": "e337c67b-55c2-4fef-8949-eb260e7fb7fd",
"publisherId": "Shan.code-settings-sync",
"publisherDisplayName": "Shan"
},
"name": "code-settings-sync",
"publisher": "Shan",
"version": "3.2.4"
},
{
"metadata": {
"id": "5960f38e-0bbe-4644-8f9c-9c8824e82511",
"publisherId": "donjayamanne.githistory",
"publisherDisplayName": "donjayamanne"
},
"name": "githistory",
"publisher": "donjayamanne",
"version": "0.4.4"
},
{
"metadata": {
"id": "4de763bd-505d-4978-9575-2b7696ecf94e",
"publisherId": "eamodio.gitlens",
"publisherDisplayName": "eamodio"
},
"name": "gitlens",
"publisher": "eamodio",
"version": "9.2.4"
},
{
"metadata": {
"id": "3d48b57c-1cf7-41d3-858c-2e6d926f2960",
"publisherId": "vayan.haml",
"publisherDisplayName": "vayan"
},
"name": "haml",
"publisher": "vayan",
"version": "1.0.1"
},
{
"metadata": {
"id": "61048194-bd70-4abb-b039-d796bf6be01c",
"publisherId": "bung87.rails",
"publisherDisplayName": "bung87"
},
"name": "rails",
"publisher": "bung87",
"version": "0.8.5"
},
{
"metadata": {
"id": "c82edf24-4810-45b3-ae65-a7e5298617f4",
"publisherId": "jemmyw.rails-fast-nav",
"publisherDisplayName": "jemmyw"
},
"name": "rails-fast-nav",
"publisher": "jemmyw",
"version": "1.2.1"
},
{
"metadata": {
"id": "c5e2e144-aae6-4eee-8ee2-9cbce01704e5",
"publisherId": "Molunerfinn.revealfileinfolder",
"publisherDisplayName": "Molunerfinn"
},
"name": "revealfileinfolder",
"publisher": "Molunerfinn",
"version": "0.0.2"
},
{
"metadata": {
"id": "ae062c8a-c68e-4b92-9ecf-8f1d4288b05d",
"publisherId": "rebornix.ruby",
"publisherDisplayName": "rebornix"
},
"name": "ruby",
"publisher": "rebornix",
"version": "0.21.0"
},
{
"metadata": {
"id": "867c2662-4ce0-4736-a22c-69975925a0c6",
"publisherId": "misogi.ruby-rubocop",
"publisherDisplayName": "misogi"
},
"name": "ruby-rubocop",
"publisher": "misogi",
"version": "0.7.1"
},
{
"metadata": {
"id": "56a57ae2-56b7-4053-a3e0-897e198f0d03",
"publisherId": "vortizhe.simple-ruby-erb",
"publisherDisplayName": "vortizhe"
},
"name": "simple-ruby-erb",
"publisher": "vortizhe",
"version": "0.2.1"
},
{
"metadata": {
"id": "66a5558f-9e27-4895-9c3e-dde3d657bc13",
"publisherId": "sianglim.slim",
"publisherDisplayName": "sianglim"
},
"name": "slim",
"publisher": "sianglim",
"version": "0.1.2"
},
{
"metadata": {
"id": "63cce059-9b09-4959-bba8-01be8a606850",
"publisherId": "bung87.vscode-gemfile",
"publisherDisplayName": "bung87"
},
"name": "vscode-gemfile",
"publisher": "bung87",
"version": "0.0.2"
}
]
// Place your key bindings in this file to override the defaultsauto[]
[
{
"key": "ctrl+shift+down",
"command": "editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+alt+down",
"command": "-editor.action.copyLinesDownAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+up",
"command": "editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+shift+alt+up",
"command": "-editor.action.copyLinesUpAction",
"when": "editorTextFocus && !editorReadonly"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpenNavigateNextInFilePicker",
"when": "inFilesPicker && inQuickOpen"
},
{
"key": "ctrl+e",
"command": "-workbench.action.quickOpen"
},
{
"key": "ctrl+e",
"command": "editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
},
{
"key": "ctrl+shift+k",
"command": "-editor.action.deleteLines",
"when": "textInputFocus && !editorReadonly"
}
]
{
"window.zoomLevel": 1,
"files.autoSave": "afterDelay",
"terminal.integrated.fontFamily": "ProFont for Powerline",
"terminal.integrated.fontSize": 16,
"editor.tabSize": 2,
"ruby.codeCompletion": "rcodetools",
"ruby.format": "rubocop",
"ruby.intellisense": "rubyLocate",
"ruby.useLanguageServer": true,
"workbench.colorTheme": "Quiet Light",
"files.autoSaveDelay": 500,
"window.openFilesInNewWindow": "on",
"workbench.editor.enablePreviewFromQuickOpen": false,
"workbench.editor.enablePreview": false,
"gitlens.currentLine.enabled": false,
"gitlens.hovers.currentLine.over": "line",
"gitlens.views.repositories.files.layout": "tree",
"editor.mouseWheelZoom": true,
"search.useGlobalIgnoreFiles": true
}
{
// Place your snippets for cpp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment