conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Reorder BoardSerializer default search and sortable attributes" }, { "from": "human", "value": "class BoardSerializer\n include TalkSerializer\n include EmbeddedAttributes\n \n all_attributes\n attribute :latest_discussion\n can_include :discussions, :parent, ...
ruby
chosen
[ { "from": "human", "value": "Add support for enabling 'Dev Mode' for the Help Viewer so it doesnt always appear above all other windows\n" }, { "from": "gpt", "value": "#\n# Cookbook Name: osx\n# Recipe Name: helpviewer\n#\n# Copyright 2013, Alex Howells <alex@howells.me>\n# See the LICENSE ...
ruby
chosen
[ { "from": "system", "value": "Remove obvious comment and extra line\n" }, { "from": "human", "value": "module Banzai\n module Filter\n # HTML Filter to modify the attributes of external links\n class ExternalLinkFilter < HTML::Pipeline::Filter\n def call\n doc.search('a').each...
ruby
chosen
[ { "from": "human", "value": "Add authentication hook for 2SV\n\nWhen a user has been authenticated by Warden using an email address and\npassphrase, we set a variable in the session saying that 2SV is\nrequired. This is picked up by the `handle_two_step_verification`\nbefore_action, forcing the user to the ...
ruby
chosen
[ { "from": "system", "value": "Set admin flag on existing memberships to true\n\nAll the existing memberships should have admin status, since we only\nadded memberships if users were admins of the repos.\nThus, we should preserve that state, otherwise all of the current repos\nwould say that they require adm...
ruby
chosen
[ { "from": "human", "value": "Revert \"Revert \"Check that publication attachments were actually created.\"\"\n\nThis reverts commit e988be5e0f90d8f5d1c961473b47fafda89061ed.\n\nThis was previously reverted as the data migration didn't run and we\ndidn't want it holding up the deploy + data migration procedu...
ruby
chosen
[ { "from": "system", "value": "Modify migration to reflect what works for P&E Dashboard\n" }, { "from": "human", "value": "class ConvertTrainingModulesToUtf8Mb4 < ActiveRecord::Migration[6.0]\n def change\n remove_index :training_slides, :slug\n execute \"ALTER TABLE training_slides ROW_FO...
ruby
chosen
[ { "from": "system", "value": "Add missing runtime dependency on serverkit\n" }, { "from": "human", "value": "lib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire \"serverkit/rbenv/version\"\n\nGem::Specification.new do |spec|\n spec.name...
ruby
chosen
[ { "from": "human", "value": "Add test for OmniauthCallbacks controller\n" }, { "from": "gpt", "value": "require 'test_helper'\n\nclass Users::OmniauthCallbacksControllerTest < ActionController::TestCase\n def after\n DatabaseCleaner.clean\n end\n\n def setup\n OmniAuth.config.test_mode ...
ruby
chosen
[ { "from": "system", "value": "Support for latest ActiveAdmin version `per_page`\n\nThe `max_per_page` method has been moved from the controller (hardcoded) to the resource (configurable). See related commit https://github.com/activeadmin/activeadmin/commit/77584fab44544ee5596c9ce1fd526f5e3a5c1e74\r\n\r\nThi...
ruby
chosen
[ { "from": "human", "value": "Add rake task for discarding drafts with schema_name \"placeholder\"\n\nThese are leftover data from the migration process to the Publishing API.\n" }, { "from": "gpt", "value": "task bulk_discard_placeholder_draft_content: :environment do\n # Result of running Cont...
ruby
chosen
[ { "from": "system", "value": "Update rom dep in gemspec\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'rom/rethinkdb/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "system", "value": "Fix deprecation warning by removing add_shipping_method\n" }, { "from": "human", "value": "FactoryGirl.define do\n factory :avalara_shipment, class: Spree::Shipment do\n tracking 'U10000'\n cost BigDecimal.new(10)\n state 'pending'\n order\n stock_lo...
ruby
chosen
[ { "from": "system", "value": "Add pry as development dependency\n\nNot required to run but useless when debugging behaviour.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'fog/brigh...
ruby
chosen
[ { "from": "system", "value": "Add JRuby persistence directive to tests.\n\nMore information: https://github.com/jruby/jruby/wiki/Persistence\n" }, { "from": "human", "value": "require \"spec_helper\"\n\nRSpec.describe Metrica::Measurable do\n\n class Test\n include Metrica::Measurable\n d...
ruby
chosen
[ { "from": "system", "value": "Test wrapper construction via object inspection since other methods not provided by BasicObject\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe Multiblock do\n it \"should construct wrapper\" do\n described_class.wrapper.class.should == Mu...
ruby
chosen
[ { "from": "system", "value": "Rename spec to reflect purpose of test\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Mementus::NodeProxy do\n specify '#new' do\n node1 = Mementus::Node.new(1, :node)\n node2 = Mementus::Node.new(2, :node)\n node3 = Mementus::Node.ne...
ruby
chosen
[ { "from": "system", "value": "Add support for reading from Ubuntu's default /var/lib/misc/dnsmasq.lxcbr0.leases\n" }, { "from": "human", "value": "module Vagrant\n module LXC\n module Action\n class FetchIpFromDnsmasqLeases\n def initialize(app, env)\n @app = app\n ...
ruby
chosen
[ { "from": "system", "value": "[TASK] Change name of the test class\n\nJust to match actual plugin class\n" }, { "from": "human", "value": "#require 'fulmar/service/helper_service'\n#require 'fulmar/domain/model/configuration'\n\nrequire 'fulmar/domain/service/plugin_service'\n\nmodule Fulmar\n ...
ruby
chosen
[ { "from": "system", "value": "Refactor with Arel to perform a single query\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\n# This class will be used to get Tax Adjustments related to an order,\n# and proceed basic calcultation over them.\n\nclass OrderTaxAdjustmentsFetcher\n ...
ruby
chosen
[ { "from": "system", "value": "Add rake as a development dependency.\n" }, { "from": "human", "value": "Gem::Specification.new do |gem|\n gem.name = 'hobble'\n gem.summary = 'Debt-based scheduling'\n gem.description = 'A ruby debt-based scheduling implementation'\n gem.authors ...
ruby
chosen
[ { "from": "system", "value": "Revert \"Revert \"Need to pass through a content-type when using upload_image to appease paperclip\"\"\n\nThis reverts commit 6c72e71a6e73cd6f2b7341386fa351ccac2c0fa7.\n" }, { "from": "human", "value": "module Spree\n module Api\n module TestingSupport\n mo...
ruby
chosen
[ { "from": "system", "value": "Test multiple repositories configured in setup\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe ROM::Roda::Plugin do\n context 'memory adapter' do\n let(:default_repository) do\n class MemoryAdapterExample < Roda\n plugin :rom, :m...
ruby
chosen
[ { "from": "system", "value": "Update redirect location after updating notifications\n" }, { "from": "human", "value": "class Admin::SettingsController < Admin::BaseController\n\n before_action :verify_admin, except: ['index', 'notifications','update_notifications']\n before_action :verify_agen...
ruby
chosen
[ { "from": "system", "value": "Use `save!` when generating new token in `TokenAuthenticatable`\n" }, { "from": "human", "value": "module TokenAuthenticatable\n extend ActiveSupport::Concern\n\n class_methods do\n def authentication_token_fields\n @token_fields || []\n end\n\n priv...
ruby
chosen
[ { "from": "system", "value": "Improve morning responder with basic regexp\n" }, { "from": "human", "value": "class MorningResponder\n class << self\n def responds_to?(msg)\n return true if msg == 'Good morning!'\n false\n end\n\n def random_morning_greeting\n [\n ...
ruby
chosen
[ { "from": "system", "value": "Add dependencies to gemspec instead of just Gemfile\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\n\nGem::Specification.new do |spec|\n spec.name = \"...
ruby
chosen
[ { "from": "system", "value": "Add support for debugging with byebug\n\nIf you wish to enable byebug for the unit tests, just run\n\n DEBUG=true rake test\n" }, { "from": "human", "value": "gem 'minitest' if RUBY_VERSION =~ /^1\\.9/\nrequire 'minitest/autorun'\nrequire 'byebug'\n\n$:.unshift...
ruby
chosen
[ { "from": "system", "value": "Change clean_generated_site to remove all the files and directories within.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'simplecov'\nSimpleCov.start\n\nrequire 'minitest/autorun'\nrequire 'tilt/redcarpet'\nrequire 'tilt/erubis'\nrequi...
ruby
chosen
[ { "from": "human", "value": "Add the AWS::RDS::EventSubscription resource type\n" }, { "from": "gpt", "value": "require_relative '../resource'\n\nmodule Convection\n module Model\n class Template\n class Resource\n ##\n # AWS::RDS::EventSubscription\n ##\n cl...
ruby
chosen
[ { "from": "system", "value": "Use \\ instead of + to concatenate those strings\n" }, { "from": "human", "value": "module NavigationHelpers\n # Maps a name to a path. Used by the\n #\n # When /^I go to (.+)$/ do |page_name|\n #\n # step definition in web_steps.feature\n #\n def path_to(p...
ruby
chosen
[ { "from": "system", "value": "Fix migration from scratch issue\n\nWhen running the migration for a new project, the `change_column\n:products, :facility_account_id, :integer, null: false` was failing\nbecause there was a foreign key attached to it. Oddly, it was only\nfailing when run on the stage server da...
ruby
chosen
[ { "from": "system", "value": "Set the right controller name\n\nThe spec for the HomeController was actually testing the EventsController\n" }, { "from": "human", "value": "require \"rails_helper\"\n\nRSpec.describe EventsController, type: :controller do\n let!(:proposed_event) { create :event,...
ruby
chosen
[ { "from": "system", "value": "Delete specs for :new route\n" }, { "from": "human", "value": "require 'rails_helper'\n\ndescribe PicksController do\n describe \"GET #new\" do\n it \"assigns a Pick to @pick\" do\n get :new\n expect(response).to be_success\n end\n\n it \"renders...
ruby
chosen
[ { "from": "human", "value": "Add a spec for Mail extensions.\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe Mail::Message do\n let(:mail_message) do\n Mail.new do\n from \"sheldon@bigbangtheory.com\"\n to \"lenard@bigbangtheory.com\"\n subject \"Hel...
ruby
chosen
[ { "from": "system", "value": "Update spec to reflect new button label\n" }, { "from": "human", "value": "require 'spec_helper'\n\n\ndescribe \"checker/_form.html.erb\" do\n before :each do\n params[:statement] = 'foo'\n render\n end\n\n it \"should include a form\" do\n rendered.shou...
ruby
chosen
[ { "from": "system", "value": "Update argument passing for RS_DESTROY\n" }, { "from": "human", "value": "require 'beaker-rspec/beaker_shim'\nrequire \"beaker-rspec/helpers/serverspec\"\ninclude BeakerRSpec::BeakerShim\n\nRSpec.configure do |c|\n # Enable color\n c.tty = true\n\n # Define persi...
ruby
chosen
[ { "from": "system", "value": "Make sure the hook says something about itself.\n\n@tooky I think they should say `before_hook` and `after_hook` - why not\nand it will surely be useful information.\n" }, { "from": "human", "value": "require 'cucumber/core/test/mapping'\nmodule Cucumber\n module C...
ruby
chosen
[ { "from": "system", "value": "Fix multiple definition of method\n" }, { "from": "human", "value": "# encoding: UTF-8\n\nmodule Morpher\n class Compiler\n # Abstract target indepentand emitter\n class Emitter\n include AbstractType, Adamantium::Flat, NodeHelpers, Procto.call(:output)\...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary require of rack/utils.\n\nrack/utils is not a dependency and therefore cannot be required.\n" }, { "from": "human", "value": "require 'geocoder/lookups/base'\nrequire \"geocoder/results/esri\"\nrequire 'rack/utils'\n\nmodule Geocoder::Lookup\n cl...
ruby
chosen
[ { "from": "system", "value": "Handle missing nodes when parsing\n" }, { "from": "human", "value": "module MWS\n module Orders\n module Parser\n class Model < Base\n include Structure\n\n def float_at_xpath(path)\n text_at_xpath(path).to_f\n end\n\n d...
ruby
chosen
[ { "from": "system", "value": "Update lib to conditionally parse out 'user@server' and specify\nusername; else use `ENV['USER']`\n\nFixes #2\n" }, { "from": "human", "value": "module GrowlTransfer\n class GTScp\n def initialize(output)\n @output = output\n end\n \n def download(...
ruby
chosen
[ { "from": "system", "value": "Remove --silent from rake tasks created via whenever/cron\n" }, { "from": "human", "value": "# IMPORTANT!!! You should never edit this file in your custom fork.\n# If you want to add custom jobs to your instance, add them to schedule_custom.rb\n\nevery 5.minutes do\...
ruby
chosen
[ { "from": "human", "value": "Add validation tests to Review model spec\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\nRSpec.describe Review, type: :model do\n let(:review) { Review.new(title: 'Good Movie', body: 'This was a fantastic film',\n user_id: User...
ruby
chosen
[ { "from": "system", "value": "Make sure that fail_on_wanrings defaults to true, but can be set to false\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe PuppetSyntax do\n after do\n PuppetSyntax.exclude_paths = []\n end\n\n it 'should default exclude_paths to empty arra...
ruby
chosen
[ { "from": "system", "value": "Add symbolized_key method to Hash\n" }, { "from": "human", "value": "module VhdlConnector::Helper\n RootPath = File.expand_path('../../..', __FILE__)\n TemplatePath = File.expand_path('./templates', RootPath)\n\n def template_path(path)\n File.expand_path(path...
ruby
chosen
[ { "from": "system", "value": "Update the order of the cash flows\n" }, { "from": "human", "value": "module GSkrilla\n class Base\n URL = \"https://www.google.com/finance?fstype=ii&q=\"\n\n attr_reader :doc, :income_statements, :cash_flows, :balance_sheets\n\n def income_statements\n ...
ruby
chosen
[ { "from": "system", "value": "Simplify monkey patch for testing purposes\n" }, { "from": "human", "value": "require \"active_record\"\n\nActiveRecord::Base.establish_connection(\n :adapter => \"sqlite3\",\n :database => \"file::memory:?cache=shared\"\n)\n\nActiveRecord::Schema.verbose = false\...
ruby
chosen
[ { "from": "system", "value": "Enable logging if DEBUG is set.\n" }, { "from": "human", "value": "require 'rspec'\nrequire 'dm-core/spec/setup'\nrequire 'dm-core/spec/lib/adapter_helpers'\n\nrequire 'dm-is-checksumed'\n\nDataMapper::Spec.setup\n\nRSpec.configure do |config|\n config.extend(DataM...
ruby
chosen
[ { "from": "system", "value": "Fix icon for Ansible credential add button\n" }, { "from": "human", "value": "class ApplicationHelper::Toolbar::AnsibleCredentialsCenter < ApplicationHelper::Toolbar::Basic\n button_group('embedded_ansible_credentials', [\n select(\n :embedded_ansible_crede...
ruby
chosen
[ { "from": "system", "value": "Fix MySQL path field length\n\nI believe the field only needs to fit 519 at the moment but I’m rounding up to be a little safer.\n\nSee the migration spec for more detail on the magic number 519.\n" }, { "from": "human", "value": "# See http://doc.gitlab.com/ce/deve...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to silence build warnings\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'jekyll-roman/version'\n\nGem::Specification.new do |spec|\n sp...
ruby
chosen
[ { "from": "system", "value": "Remove diff and warning of cached and fresh synced folders\n" }, { "from": "human", "value": "require 'vagrant/action/builtin/mixin_synced_folders'\n\nmodule Vagrant\n module Syncer\n class Machine\n\n include Vagrant::Action::Builtin::MixinSyncedFolders\n\...
ruby
chosen
[ { "from": "system", "value": "Change calls of ReactOnRails to Rails.application\n" }, { "from": "human", "value": "# lib/tasks/assets.rake\n# The webpack task must run before assets:environment task.\n# Otherwise Sprockets cannot find the files that webpack produces.\nRake::Task[\"assets:precomp...
ruby
chosen
[ { "from": "system", "value": "Fix method missing lookup of formula class" }, { "from": "human", "value": "require \"odyssey/version\"\n\nmodule Odyssey\n\n DEFAULT_FORMULA = 'FleschKincaidRe'\n\n #main method\n def self.analyze(text, formula_name = DEFAULT_FORMULA, all_stats = false)\n #ca...
ruby
chosen
[ { "from": "system", "value": "Fix error in the `rake bundle` task\n\nSo that `bundle exec rake bundle[update,loofah]` works.\n" }, { "from": "human", "value": "desc \"Bundle all Gemfiles\"\ntask :bundle do |_t, opts|\n [\"Gemfile\", *Dir.glob(\"gemfiles/*.gemfile\")].each do |gemfile|\n Bund...
ruby
chosen
[ { "from": "system", "value": "Add done command to mark as done guide\n" }, { "from": "human", "value": "require 'thor'\nrequire 'text-table'\n\nmodule WorkGuide\n class CLI < Thor\n desc \"add [guide description]\", \"Add a new guide\"\n option :cycle, default: 'daily', banner: '[hourly|d...
ruby
chosen
[ { "from": "system", "value": "Check config in acceptance tests\n" }, { "from": "human", "value": "require 'spec_helper_acceptance'\n\ndescribe 'freeradius' do\n context 'when running puppet code' do\n pp = \"class { 'freeradius': }\"\n\n it 'should apply with no errors' do\n apply_ma...
ruby
chosen
[ { "from": "human", "value": "Add specs testing that shipments see deleted variants\n" }, { "from": "gpt", "value": "require \"spec_helper\"\n\ndescribe Spree::Shipment do\n describe \"manifest\" do\n let!(:product) { create(:product) }\n let!(:order) { create(:order, distributor: product....
ruby
chosen
[ { "from": "system", "value": "Add minitest as development dependency\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'jeu_de_cartes/version'\n\nGem::Specification.new do |spec|\n spe...
ruby
chosen
[ { "from": "system", "value": "Add an options to exclude paths\n" }, { "from": "human", "value": "#\n# Manage shared files\n#\n# Configuration:\n#\n# - `shared_rsync_options`: Allow to specify which options to be used to pull rsync (default: `-avz --no-owner --no-group -delete`)\n# - `shared_sync...
ruby
chosen
[ { "from": "system", "value": ":anchor: Add a method to set an embed's colour\n" }, { "from": "human", "value": "module Discordrb::Webhooks\n # An embed is a multipart-style attachment to a webhook message that can have a variety of different purposes and\n # appearances.\n class Embed\n de...
ruby
chosen
[ { "from": "system", "value": "Work around Time parsing for bad NPR data\n" }, { "from": "human", "value": "require 'time'\n\n##\n# NPR::Concern::AttrTypecast\n#\nmodule NPR\n #------------------\n # Attributes that are being typecast to Ruby classes\n ATTR_TYPES = {\n \"id\" ...
ruby
chosen
[ { "from": "system", "value": "Use if instead of unless to keep logic simpler" }, { "from": "human", "value": "require \"active_support/concern\"\nrequire \"active_support/core_ext/class/attribute\"\n\nmodule PgSearch\n module Multisearchable\n extend ActiveSupport::Concern\n\n included do...
ruby
chosen
[ { "from": "system", "value": "Split tokenize method into two methods\n" }, { "from": "human", "value": "module Primix\n module Analyzer\n class Tokenizer\n\n attr_reader :content\n\n def initialize(content)\n @content = content\n end\n\n def tokenize!\n char...
ruby
chosen
[ { "from": "human", "value": "Add example for changing default sample rate\n\nWhilst this is documented in `ext/coreaudio.m` it wasn't immediately\nobvious. This commit includes a simple example to allow users to change\nthe default sample rate from the command line on OSX\n" }, { "from": "gpt", ...
ruby
chosen
[ { "from": "human", "value": "Add tests for the cumulus_license provider\n" }, { "from": "gpt", "value": "require 'serverspec'\n\nset :backend, :exec\nset :path, '/bin:/usr/bin:/sbin/usr/sbin'\n\ndescribe file('/etc/cumulus/.license.txt') do\n it { should be_file }\n its(:content) { should matc...
ruby
chosen
[ { "from": "human", "value": "Set most organisations status to \"joining\" i.e. \"Coming soon\".\n\nWe want most organisations to be labelled as \"Coming soon\" ready for\nwhen the 1st departments go live.\n\nRe-indexing of ministerial roles normally happens after every save of an\norganisation. I used the `...
ruby
chosen
[ { "from": "system", "value": "Solve the unknown branch problem\n" }, { "from": "human", "value": "namespace :git do\n\n desc 'Deploy via git pull'\n task :pull do\n on roles :app do\n within release_path do\n execute :git, :checkout, '--', 'db/schema.rb', 'Gemfile.lock'\n ...
ruby
chosen
[ { "from": "system", "value": "Use action_controller_base hook to load helper\n" }, { "from": "human", "value": "module EffectivePosts\n class Engine < ::Rails::Engine\n engine_name 'effective_posts'\n\n # Include Helpers to base application\n initializer 'effective_posts.action_control...
ruby
chosen
[ { "from": "system", "value": "Add tests for the MPL download fix\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass MplDownloadCreateJobTest < ActiveJob::TestCase\n setup do\n @bundle = FactoryBot.create(:static_bundle)\n # Clean up MPL before and after running for consiste...
ruby
chosen
[ { "from": "system", "value": "Correct description for anonymous admin panel access test\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"Admin panel, pages\" do\n before do\n create_page!(:root)\n end\n \n context \"no user\" do\n it \"should render correctly from...
ruby
chosen
[ { "from": "system", "value": "Use hash splat without giving hash as argument\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'spec_helper'\nrequire './lib/fusuma/plugin/events/event.rb'\n\nmodule Fusuma\n module Plugin\n module Events\n RSpec.describe Event d...
ruby
chosen
[ { "from": "system", "value": "Change primary key to match response primary key format\n" }, { "from": "human", "value": "module Sendvia\n class Base < ActiveResource::Base\n self.include_format_in_path = false\n REST_API_ENDPOINT = 'https://www.sendvia.co.uk/rest/alpha5/'\n\n def self....
ruby
chosen
[ { "from": "system", "value": "Add test cases for @disable_auto_cosmeticize\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass CosmeTest < ActiveSupport::TestCase\n teardown do\n Cosme.instance_variable_set(:@cosmetics, nil)\n end\n\n test 'has a version number' do\n refut...
ruby
chosen
[ { "from": "system", "value": "Rename endpoint variable to route\n" }, { "from": "human", "value": "module Galago\n class Router\n NotFound = [ 404, { 'Content-Type' => 'text/plain' }, [\"Not Found\"]]\n\n attr_reader :routes\n\n def initialize\n @routes = {\n \"GET\" => ...
ruby
chosen
[ { "from": "system", "value": "guests/fedora: Fix indentation on configure hostname" }, { "from": "human", "value": "module VagrantPlugins\n module GuestFedora\n module Cap\n class ChangeHostName\n def self.change_host_name(machine, name)\n comm = machine.communicate\n\n ...
ruby
chosen
[ { "from": "system", "value": "Remove debug code in day 14\n" }, { "from": "human", "value": "require 'pp'\n\ninput = File.read 'input.txt'\n\nspeeds = {}\n\ninput.each_line do |line|\n next if line =~ /^\\s+$/\n\n name, speed, run_time, rest_time = line.match(/(\\w+) can fly (\\d{1,2}) km\\/s ...
ruby
chosen
[ { "from": "human", "value": "Create seed data for the Celebrities topic of the topics table\n\n- creates one topic object (Celebrities)\n- creates twitter_handle objects which includes one real twitter_handle and one plus fake twitter_handle(s)\n- this file is required by seeds.rb, which gets run in a rake ...
ruby
chosen
[ { "from": "system", "value": "Switch to http git url\n" }, { "from": "human", "value": "lock '3.4.0'\n\nset :application, 'socket.io-webservice'\nset :repo_url, 'git@github.com:crossroads/socket.io-webservice.git'\nset :deploy_to, '/opt/node/socket.io-webservice'\nset :linked_files, fetch(:linke...
ruby
chosen
[ { "from": "system", "value": "Use !(regex =~ str).nil? rather than (regex =~ str) != nil\n" }, { "from": "human", "value": "require 'rbconfig'\n\nmodule Overcommit\n # Methods relating to the current operating system\n module OS\n class << self\n def windows?\n (/mswin|msys|ming...
ruby
chosen
[ { "from": "system", "value": "Add rake task to set cover photos\n" }, { "from": "human", "value": "namespace :album do\n desc \"Upload all photos in an album\"\n task :upload, [:path] => :environment do |t, args|\n path = File.expand_path(args.path)\n title = Pathname.new(path).basename....
ruby
chosen
[ { "from": "system", "value": "Refactor HW path into method\n" }, { "from": "human", "value": "require \"fileutils\"\nrequire \"uri\"\nmodule TiyoHw\n class Setup\n attr_accessor :url\n def initialize(url)\n @url = url\n end\n\n def sha\n matches = /\\b[0-9a-f]{5,40}\\b/.ma...
ruby
chosen
[ { "from": "system", "value": "Use GET fields instead of POST\n" }, { "from": "human", "value": "require \"sinatra/base\"\nrequire \"json\"\n\nrequire_relative \"./logging.rb\"\nrequire_relative \"./error.rb\"\n\nrequire_relative \"./calculatorrouter.rb\"\nrequire_relative \"./calculatorloader.rb...
ruby
chosen
[ { "from": "system", "value": "Use correct type in activemodel integration.\n" }, { "from": "human", "value": "require 'elsearch-node'\nrequire 'jruby'\n\nDir[\"#{ElasticSearch::Node.lib}/*.jar\"].each do |jar|\n require jar\nend\n\nmodule ElasticSearch\n module Node\n class Embedded\n ...
ruby
chosen
[ { "from": "system", "value": "Allow to change Chanko::Config.eager_load after loading chanko\n" }, { "from": "human", "value": "module Chanko\n class Railtie < Rails::Railtie\n initializer \"chanko\" do |app|\n ActiveSupport.on_load :action_view do\n ::ActionView::Base.send(:incl...
ruby
chosen
[ { "from": "system", "value": "Define methods for valid config values\n\nRather than relying on method_missing always, which\nis slower than we want, define a method if the configuration\nhas data for that method name / key. This way we immediately\nreturn data from the hash instead of going through the\nmet...
ruby
chosen
[ { "from": "system", "value": "Use Rails.root instead of RAILS_ROOT\n" }, { "from": "human", "value": "require 'kaltura_fu'\nrequire 'kaltura_fu/view_helpers'\nrequire 'rails'\n\nmodule KalturaFu\n class Railtie < Rails::Railtie\n initializer 'install kaltura_fu' do\n $: << File.dirname(...
ruby
chosen
[ { "from": "human", "value": "Add rake rake to generate secret key and save to .env file\n" }, { "from": "gpt", "value": "namespace :setup do\n task secret_key_dotenv: :environment do\n unless File.exists?(Rails.root.to_s + '/.env')\n system \"echo \\\"SECRET_KEY_BASE: $(bundle exec rake...
ruby
chosen
[ { "from": "human", "value": "Add controller tests for institutions\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\nRSpec.describe Admin::InstitutionsController, type: :controller do\n include Devise::TestHelpers\n\n # This should return the minimal set of attributes required to crea...
ruby
chosen
[ { "from": "human", "value": "Add a custom fact that returns 75% of the memory in MB for varnish\n" }, { "from": "gpt", "value": "require 'facter'\n# A fact that is equal to 75% of the memory in MB\nFacter.add(\"varnish_cachesize_mb\") do\n confine :kernel => :linux\n ram = 0\n File.open...
ruby
chosen
[ { "from": "human", "value": "Add code wars (7) - find the anonymous function\n" }, { "from": "gpt", "value": "# http://www.codewars.com/kata/55a12bb8f0fac1ba340000aa/\n# --- iteration 1 ---\ndef find_function(func, arr)\n anon = func.find{ |x| x.is_a?(Proc) }\n arr.map { |x| anon.call(x) ? x :...
ruby
chosen
[ { "from": "system", "value": "Remove dummy test which was failing\n" }, { "from": "human", "value": "require_relative 'spec_helper'\n\ndescribe 'Account' do\n it 'has a version number' do\n ::AccountBooks::VERSION.wont_be_nil\n end\n\n it 'does something useful' do\n assert false\n end...
ruby
chosen
[ { "from": "human", "value": "Update line item promotion eligibility" }, { "from": "gpt", "value": "Spree::OrderUpdater.class_eval do\n def choose_best_promotion_adjustment\n if best_promotion_adjustment = order.adjustments.promotion.eligible.reorder(\"amount ASC, created_at DESC\").first\n ...
ruby
chosen
[ { "from": "system", "value": "Address an off-by-one issue in Crop command.\n\nRMagick expects a `width` parameter, not a position, which means we are *not* zero-based.\n" }, { "from": "human", "value": "module Compass::Magick::Commands\n class Crop < Compass::Magick::Command\n include Compas...
ruby
chosen
[ { "from": "system", "value": "Change to remove synchronization and data mutation\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire_relative 'transition_builder'\nrequire_relative 'threadable'\n\nmodule FiniteMachine\n # A class responsible for merging choice options\n ...
ruby
chosen
[ { "from": "system", "value": "Change to instatiate without synching vars\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire_relative 'transition_builder'\nrequire_relative 'threadable'\n\nmodule FiniteMachine\n # A class responsible for merging choice options\n class C...
ruby
chosen
[ { "from": "system", "value": "Add missing required argument to API docs\n" }, { "from": "human", "value": "class CartPaymentsController < ApplicationController\n include Roar::Rails::ControllerAdditions\n include Roar::Rails::ControllerAdditions::Render\n\n # :nocov:\n swagger_controller :ca...
ruby
chosen
[ { "from": "system", "value": "Add eager loading for dashboard todos.\n" }, { "from": "human", "value": "class DashboardController < ApplicationController\n before_action :authenticate_user!\n def show\n @todays_todo_list = TodoList.today(current_user)\n @past_todo_lists = TodoList.past(c...
ruby
chosen
[ { "from": "system", "value": "Use Rails helper method to generate grouped select\n\nPerhaps this was built manually as the `with_translations_for` method was\ninvolved? It doesn't appear to have mattered, as including translations\nin the AREL code seems to have done the job nicely; the HTML produced is\nid...
ruby
chosen