conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix gemspec to use README.md, not .rdoc.\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"has_vcards/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new ...
ruby
chosen
[ { "from": "system", "value": "Handle gracefully missing number_of nil\n\nHandle gracefully missing number_of nil, which can occur when\nwe delegate association and the receiving object is nil.4\n\nFixes BZ:\nhttps://bugzilla.redhat.com/show_bug.cgi?id=1364458\n" }, { "from": "human", "value": "m...
ruby
chosen
[ { "from": "system", "value": "Fix relative path for the userdata\n" }, { "from": "human", "value": "module Parker\n\n def self._load(name)\n load File.join(File.expand_path(\"../../../../user_data\", __FILE__), \"#{name}.rb\")\n end\n\n def self.user_data(name, domain, host)\n _load(name)\n ...
ruby
chosen
[ { "from": "system", "value": "Fix schema dump/load for test\n" }, { "from": "human", "value": "namespace :second_base do\n task :migrate do\n SecondBase.on_base { Rake::Task['db:migrate'].execute }\n end\n\n task :create do\n SecondBase.on_base { Rake::Task['db:create'].execute }\n end...
ruby
chosen
[ { "from": "system", "value": "Include Java in CLI recipe, unless skip is requested\n" }, { "from": "human", "value": "#\n# Cookbook Name:: cdap\n# Recipe:: cli\n#\n# Copyright © 2013-2015 Cask Data, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use t...
ruby
chosen
[ { "from": "system", "value": "Add strong params to CustomerdetailsController\n" }, { "from": "human", "value": "module Spree\n module Admin\n module Subscriptions\n class CustomerDetailsController < Spree::Admin::BaseController\n before_filter :load_subscription\n\n def sh...
ruby
chosen
[ { "from": "system", "value": "Fix issue with description for deployment\n" }, { "from": "human", "value": "class AutoDeployment\n include ApiClient\n\n attr_accessor :commit_status, :deployment\n\n def initialize(deployment, commit_status)\n @commit_status = commit_status\n @deployment ...
ruby
chosen
[ { "from": "human", "value": "Update previous role appointment for Sarah Albon\n\nIt seems the Person Sarah Albon was assigned an incorrect role appointment. The\ncorrect role appointment has now been created, however we also need to update\nall content tagged to Sarah and the incorrect role appointment.\n" ...
ruby
chosen
[ { "from": "system", "value": "Add Pavel to gemspec as an author\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'jbuilder'\n s.version = '2.0.6'\n s.author = 'David Heinemeier Hansson'\n s.email = 'david@37signals.com'\n s.summary = 'Create JSON struct...
ruby
chosen
[ { "from": "system", "value": "Use loop for infinite loops\n" }, { "from": "human", "value": "class PeriodicTask\n def initialize(every:, run_immediately: true)\n @mutex = Mutex.new\n @stop_next_tick = false\n block = proc\n\n @thread = Thread.new do\n Thread....
ruby
chosen
[ { "from": "system", "value": "Change place to point in RouteService\n" }, { "from": "human", "value": "class RouteService\n attr_reader :origin, :destination, :paths\n\n def initialize(origin, destination)\n @origin = origin\n @destination = destination\n @paths = []\n end\n\n def f...
ruby
chosen
[ { "from": "human", "value": "Change task end_date field from date to datetime\n" }, { "from": "gpt", "value": "class ChangeTaskEndDateFromDateToDateTime < ActiveRecord::Migration\n\n def up\n change_column :tasks, :end_date, :datetime\n end\n\n def down\n change_column :tasks, :end_da...
ruby
chosen
[ { "from": "system", "value": "[frontend] Remove useless comments in Admin::OverviewController\n" }, { "from": "human", "value": "# this clas was inspired (heavily) from the mephisto admin architecture\nmodule Spree\n module Admin\n class OverviewController < Spree::Admin::BaseController\n ...
ruby
chosen
[ { "from": "system", "value": "Implement the aria-labelledby attribute in the text_field helper method. ooverride the render method to waiable gem.\n" }, { "from": "human", "value": "module ActionView\n module Helpers\n module FormTagHelper\n\n def label_tag(name = nil, content_or_option...
ruby
chosen
[ { "from": "system", "value": "Add @state field to Battery widget\n" }, { "from": "human", "value": "# Copyright (C) 2008 Dag Odenhall <dag.odenhall@gmail.com>\n# Licensed under the Academic Free License version 3.0\n\nrequire 'amazing/widget'\nrequire 'amazing/proc_file'\n\nmodule Amazing\n mod...
ruby
chosen
[ { "from": "system", "value": "Kill proper process parent and wait after tests to shutdown.\n" }, { "from": "human", "value": "require 'timeout'\n\nmodule MongrelHelper\n attr_accessor :pid\n\n def setup\n check_mongrel\n Process.spawn(\"bundle exec foreman start --procfile=example/Procfi...
ruby
chosen
[ { "from": "system", "value": "Update .find to work with rails 4.2\n" }, { "from": "human", "value": "module Spree\n module Stock\n Quantifier.class_eval do\n durably_decorate :can_supply?, mode: 'soft', sha: '2759d397d8dafe5bc3e5eed2d881fa0ab3a1a7c9' do |required|\n original_can_...
ruby
chosen
[ { "from": "system", "value": "Add rubocop as a dev dependency\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'reagan'\n s.version = '0.8.1'\n s.date = Date.today.to_s\n s.platform = Gem::Platform::RUBY\n s.extra_rdoc_files = ['README.md', 'LICE...
ruby
chosen
[ { "from": "system", "value": "Use the heap size set in Chef via /etc/default/elasticsearch\n\nCloses: #170\n" }, { "from": "human", "value": "# See <http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/_linux.html>\n\nfilename = node.elasticsearch[:deb_url].split('/').last\n\nre...
ruby
chosen
[ { "from": "system", "value": "Remove unneeded code in controller\n" }, { "from": "human", "value": "class PostsController < ApplicationController\n before_action :set_post, only: [:show, :edit, :update, :destroy]\n\n # GET /posts\n # GET /posts.json\n def index\n @posts = Post.all\n end\...
ruby
chosen
[ { "from": "system", "value": "Allow offers to be posted to database.\n" }, { "from": "human", "value": "class OffersController < ApplicationController\n before_action :set_offer, only: [:show, :edit, :update, :destroy]\n\n def index\n @offers = Offer.all\n respond_with(@offers)\n end\n\...
ruby
chosen
[ { "from": "system", "value": "Remove save from export needs to be on push to lri" }, { "from": "human", "value": "class TaggerController < ApplicationController\n def index\n end\n \n # Saves a string to a file named filename on a user's machine\n def save_local\n Tag.new(:session_id => ...
ruby
chosen
[ { "from": "system", "value": "Fix name filter in web traces\n" }, { "from": "human", "value": "class TracesController < ApplicationController\n def index\n @traces = Trace\n .joins(:spans)\n .includes(:spans)\n .where(name: 'app.rack.request')\n .order(start: :desc)\n ...
ruby
chosen
[ { "from": "system", "value": "Check if ng-app exists without returning large object\n\nIn my app, returning the hash slowed down the tests caused a lot of timeout errors\n" }, { "from": "human", "value": "module Capybara\n module Angular\n class Waiter\n attr_accessor :page\n\n def...
ruby
chosen
[ { "from": "system", "value": "Add a to_json that returns real data." }, { "from": "human", "value": "module CiInACan\n class TestResult\n\n PERSISTENCE_TYPE = 'test_result'\n\n params_constructor\n\n attr_accessor :id\n attr_accessor :passed, :output\n\n def self.create values\n ...
ruby
chosen
[ { "from": "system", "value": "Sort courses from high to low recent edits\n" }, { "from": "human", "value": "require \"#{Rails.root}/lib/word_count\"\n\n#= Presenter for courses / cohort view\nclass CoursesPresenter\n attr_reader :current_user, :cohort_param\n\n def initialize(current_user, coh...
ruby
chosen
[ { "from": "system", "value": "Rename 'error' to 'danger', take it or leave it" }, { "from": "human", "value": "module Filters\n module PostFilter\n def format_admonitions!(html)\n html.gsub!(/<p>#{Filters.front_wrap}\\s*#tip\\s*#{Filters.end_wrap}<\\/p>/, '<div class=\"alert tip\">'...
ruby
chosen
[ { "from": "system", "value": "Load performances having artist with image" }, { "from": "human", "value": "class EventSerializer < ActiveModel::Serializer\n attributes :id, :title, :poster, :venue_name, :venue_city, :venue_country, :venue_latitude, :venue_longitude, :starts_at, :ends_at\n\n has...
ruby
chosen
[ { "from": "system", "value": "Modify access to instance in params\n" }, { "from": "human", "value": "class CreateSubscription < ActiveRecord::Base\n\n def self.call(params)\n # plan is object with data relative to plan, stated in seed.\n plan_id = Plan.find_by_amount(params[:plan]).id\n ...
ruby
chosen
[ { "from": "system", "value": "Change glob to return only ruby files so that other assets may be pu under db/seeds without causing problems.\n" }, { "from": "human", "value": "module PhilColumns\n module SeedUtils\n\n SEED_REGEX = /^\\w+\\/\\w+\\/(\\d{14})_(.+)\\.rb$/\n\n def load_seeds\n...
ruby
chosen
[ { "from": "system", "value": "Update choices controller to create new potential reply\n" }, { "from": "human", "value": "get '/choices/new' do\n @choice_numbers = (1..params[:question_choices].to_i).to_a\n @question = Question.create(params[:question])\n @survey = @question.survey\n erb :'/c...
ruby
chosen
[ { "from": "system", "value": "Fix typo in resume_params. Should be skill_ids, not skills_ids\n\nSigned-off-by: Max Fierke <0706025b2bbcec1ed8d64822f4eccd96314938d0@maxfierke.com>\n" }, { "from": "human", "value": "class ResumesController < ApplicationController\n before_action :set_resume, only...
ruby
chosen
[ { "from": "system", "value": "Update scripts controller to work with Rails 3.\n" }, { "from": "human", "value": "# encoding: UTF-8\nclass ScriptsController < ApplicationController\n def index\n if !current_user.admin?\n flash['notice'] = _(\"Only admins can edit company settings.\")\n ...
ruby
chosen
[ { "from": "system", "value": "Add spec for viewing the apidocs models\n" }, { "from": "human", "value": "require File.dirname(__FILE__) + '/../spec_helper'\n\ndescribe ApidocsController do\n\n it 'does not create example objects if there are no organizations on first access' do\n \n Proje...
ruby
chosen
[ { "from": "system", "value": "Move the static pages array to the private method, remove the @frequently_updated_pages\n" }, { "from": "human", "value": " class SitemapController < ApplicationController\n\n def index\n @static_pages = [root_url, about_url, contact_url, faq_url, login_url, s...
ruby
chosen
[ { "from": "system", "value": "Rework options hash to potentially handle multiples\n" }, { "from": "human", "value": "require \"tablexi/logger/severities\"\n\nmodule Tablexi\n class Logger\n class Standard\n include Tablexi::Logger::Severities\n\n attr_reader :logger\n attr_rea...
ruby
chosen
[ { "from": "system", "value": "Return an array of bans on the session user.\n" }, { "from": "human", "value": "object false\nnode(:client_id) { SecureRandom.hex(16) }\nchild(current_user) do\n extends 'api/v1/users/private'\n \n child :clouds => :clouds do\n extends 'api/v1/clouds/base'\n ...
ruby
chosen
[ { "from": "system", "value": "Fix the title/tooltip attribute setting for TreeNode::Menu::Item\n" }, { "from": "human", "value": "module TreeNode\n module Menu\n class Item < TreeNode::Menu::Node\n set_attribute(:key) { \"#{@tree.node_id_prefix}__#{@object.feature}\" }\n\n set_attr...
ruby
chosen
[ { "from": "system", "value": "Fix targets_archived_from after refactoring to MetricsCapture\n\nWhen we moved the capture_ems_targets out of Metrics::Capture and into\nprovider subclasses we didn't catch that this method being called is\nstill in Metric::Capture\n" }, { "from": "human", "value": ...
ruby
chosen
[ { "from": "system", "value": "Add separate assertion for getting a result at all.\n" }, { "from": "human", "value": "$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[ .. .. lib]))\nrequire 'pathname'\nrequire 'rubygems'\nrequire 'test/unit'\nrequire 'geocoder'\n\nclass SmokeTest < Test::...
ruby
chosen
[ { "from": "system", "value": "Fix breaky function by changing nothing\n" }, { "from": "human", "value": "class HomeController < ApplicationController\n def index\n locational # in applaction controller\n\n params = { category: '1',\n zip: '27701',\n format: 'json',\n page: ...
ruby
chosen
[ { "from": "system", "value": "Create manifest file in init\n" }, { "from": "human", "value": "require 'thor'\nrequire 'bowery/assetfile'\nrequire 'bowery/bower_config'\nrequire 'pry'\n\n# The executable that installs Bower assets.\n\nmodule Bowery\n class Executable < Thor\n include Thor::Ac...
ruby
chosen
[ { "from": "human", "value": "Add a trivial spec for the location of CipherError in OpenSSL (JRUBY-3163)\n" }, { "from": "gpt", "value": "require File.dirname(__FILE__) + '/../../spec_helper'\nrequire File.dirname(__FILE__) + '/shared/constants'\nrequire 'openssl'\n\ndescribe \"OpenSSL::Cipher's ...
ruby
chosen
[ { "from": "system", "value": "Remove HQ from list of tables for scenarios\n\nWill need to add back later\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nclass GmsByScenarioController < ApplicationController\n before_action :get_event, :get_unknown_user, :get_unknown_user_eve...
ruby
chosen
[ { "from": "system", "value": "Initialize tokens hash outside method\n" }, { "from": "human", "value": "require 'strscan'\n\nmodule Braingasm\n class Tokenizer < Enumerator\n attr_accessor :input\n attr_reader :line_numer, :column_number\n\n def initialize(input)\n @line_numer = 1\...
ruby
chosen
[ { "from": "human", "value": "Add specs for references commands.\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\nrequire 'spec_helper'\n\ndescribe GithubCLI::Commands::References do\n let(:format) { 'table' }\n let(:user) { 'peter-murach' }\n let(:repo) { 'github_cli' }\n let(:ref) ...
ruby
chosen
[ { "from": "system", "value": "Test admin generator with fake stdin\n" }, { "from": "human", "value": "require \"rails_helper\"\nrequire \"generators/admin_generator\"\n\ndescribe AdminGenerator, type: :generator do\n context \"with valid admin credentials\" do\n before(:each) do\n admin...
ruby
chosen
[ { "from": "system", "value": "Fix load exceptions by not reloading environment\n" }, { "from": "human", "value": "module Specjour\n module DbScrub\n require 'rake'\n if defined?(Rails) && Rails.version =~ /^3/\n task(:environment) {}\n load 'rails/tasks/misc.rake'\n load 'a...
ruby
chosen
[ { "from": "system", "value": "Add backtrace info to exception logging\n" }, { "from": "human", "value": "require 'state_machine_job/version'\nrequire 'state_machine_job/macro'\n\nrequire 'resque'\nrequire 'resque/plugins/logger'\nrequire 'resque_logger'\n\nmodule StateMachineJob\n include Resqu...
ruby
chosen
[ { "from": "system", "value": "Test change commit with tortoise.\n" }, { "from": "human", "value": "class String\n\n # Duplicates the current string by count and returns that as a new string.\n def times(count)\n val = []\n count.times {val << self}\n val.join\n end\n\n # Makes the s...
ruby
chosen
[ { "from": "system", "value": "Add missing logger option to Scheduler.\n" }, { "from": "human", "value": "module Workers\n class Scheduler\n def initialize(options = {})\n @pool = options[:pool] || Workers::Pool.new\n @schedule = SortedSet.new\n @mutex = Mutex.new\n @threa...
ruby
chosen
[ { "from": "system", "value": "Use saved search name as default value for Librato Metrics gauge name\n" }, { "from": "human", "value": "# encoding: utf-8\nclass Service::LibratoMetrics < Service\n def receive_logs\n name = settings[:name].gsub(/ +/, '_')\n\n # values[hostname][time]\n v...
ruby
chosen
[ { "from": "human", "value": "Rename Silverline service to LibratoMetrics\n" }, { "from": "gpt", "value": "# encoding: utf-8\nclass Service::LibratoMetrics < Service\n def receive_logs\n values = Hash.new { |h,k| h[k] = 0 }\n\n payload[:events].each do |event|\n time = Time.parse(even...
ruby
chosen
[ { "from": "human", "value": "Add missing migration from BigbluebuttonRails 2.0.0\n\nThe column size was ok in most of the servers but not in others, where the\nmigration to BigbluebuttonRails was done in several steps.\n" }, { "from": "gpt", "value": "class BigbluebuttonRails200RecordingSize < A...
ruby
chosen
[ { "from": "system", "value": "Split filter into two functions: filter and replace\n\nThe new filter function rejects whole events.\n\nThe replace function replaces regular expression matches with the\nprovided substitute.\n" }, { "from": "human", "value": "require 'icalendar'\nrequire 'open-uri'...
ruby
chosen
[ { "from": "system", "value": "Revert \"Fix bug 'Unsupported ruby class used as database type: Bignum'\"\n\nThis reverts commit dd345e564912d0892dd79b15fe815c7169293284.\n" }, { "from": "human", "value": "Sequel.migration do\n\n up do\n add_column :orders, :amount_paid, :Bignum\n end\n\n do...
ruby
chosen
[ { "from": "system", "value": "Include hours and minutes in filename\n" }, { "from": "human", "value": "require 'nifty-report/model'\n\nmodule Nifty\n class Report\n def initialize(sql, name, connection_string = nil)\n @sql = sql\n @name = name\n @connection_string = connection...
ruby
chosen
[ { "from": "system", "value": "Allow env to be passed to the optional block.\n" }, { "from": "human", "value": "module Rack # :nodoc:\n class CanonicalHost\n def initialize(app, host=nil, &block)\n @app = app\n @host = (block_given? && block.call) || host\n end\n\n def call(en...
ruby
chosen
[ { "from": "system", "value": "Add comment about using Kernel in file fetcher\n" }, { "from": "human", "value": "require 'open-uri'\nrequire 'socket'\nrequire_relative 'network_connection_error'\n\nmodule Resume\n class FileFetcher\n\n def self.fetch(file, &block)\n new(file, &block).fet...
ruby
chosen
[ { "from": "human", "value": "Create import SicCode rake task\n" }, { "from": "gpt", "value": "require 'csv'\ndesc \"Import SIC Codes from /app/assets/csv/sic_codes.csv\"\nnamespace :import do\n task :sic_codes => :environment do\n counter = 0\n CSV.foreach(\"#{Rails.root}/app/assets/csv/s...
ruby
chosen
[ { "from": "system", "value": "Check serve_static_files before trying to load ActionDispatch::Static\n" }, { "from": "human", "value": "require 'kaminari'\nmodule StashEngine\n class Engine < ::Rails::Engine\n isolate_namespace StashEngine\n\n # Initializer to combine this engines static a...
ruby
chosen
[ { "from": "system", "value": "Change to class from module(Syoboemon::Connector)\n" }, { "from": "human", "value": "module Syoboemon\n\tmodule Connector\n\t\tURL\t\t\t= \"http://cal.syoboi.jp\"\n\t\tRSS2_PATH\t= \"/rss2.php\"\n\t\tDB_PATH\t\t= \"/db.php\"\n\t\tJSON_PATH\t= \"/json.php\"\n\n\t\tcl...
ruby
chosen
[ { "from": "system", "value": "Raise exception if a board_id is not provided.\n\nWe ought to validate board_ids." }, { "from": "human", "value": "module Trlo\n class ListPresenter\n def initialize(board_id)\n @board_id = board_id\n end\n\n def self.all(board_id)\n new(board_id...
ruby
chosen
[ { "from": "system", "value": "Configure wulin_master to precompile master.js and master.css\n" }, { "from": "human", "value": "require \"rails\"\n\nmodule WulinMaster\n\n class Engine < Rails::Engine\n engine_name :wulin_master \n end\nend" }, { "from": "gpt", "value": "require ...
ruby
chosen
[ { "from": "system", "value": "Use fork and exec instead of backticks for subprocesses\n" }, { "from": "human", "value": "module XCListen\n\n class ShellTask\n\n def self.run(args)\n puts args + \"\\n\\n\"\n `#{args}`\n end\n\n end\n\nend\n\n" }, { "from": "gpt", "va...
ruby
chosen
[ { "from": "system", "value": "Sort loaded files in ABC-order\n" }, { "from": "human", "value": "require \"json\"\nrequire \"json_schema\"\nrequire \"multi_json\"\n\nrequire \"rack/spec/error_handler\"\nrequire \"rack/spec/error\"\nrequire \"rack/spec/request_validation\"\nrequire \"rack/spec/sch...
ruby
chosen
[ { "from": "system", "value": "Add global config for braintree\n" }, { "from": "human", "value": "require 'sinatra/base'\nrequire 'tilt/haml'\nrequire 'json'\nrequire 'digest/sha2'\nrequire 'open-uri'\nrequire 'bcrypt'\nrequire 'net/smtp'\nrequire 'sendgrid-ruby'\nrequire 'data_mapper'\nrequire '...
ruby
chosen
[ { "from": "system", "value": "Support querystrings in badge URL\n\nThis allows the use of the other shields.io badge styles." }, { "from": "human", "value": "require 'sinatra'\nrequire 'open-uri'\nrequire 'digest/sha1'\nrequire 'haml'\n\ndef heroku_url\n \"https://#{params[:app]}.herokuapp.com/...
ruby
chosen
[ { "from": "system", "value": "Add Dev Config To Deliver Emails For Testing\n" }, { "from": "human", "value": "Rails.application.configure do\n # Settings specified here will take precedence over those in config/application.rb.\n\n # In the development environment your application's code is rel...
ruby
chosen
[ { "from": "system", "value": "Change the aws bucket name to a env variable\n" }, { "from": "human", "value": "CarrierWave.configure do |config|\n if Rails.env.production?\n config.fog_credentials = {\n :provider => 'AWS',\n :aws_access_key_id => ENV['AWS_ACCESS_K...
ruby
chosen
[ { "from": "system", "value": "Use rescue as conditional on environment variable\n" }, { "from": "human", "value": "CarrierWave.configure do |config|\n if ENV.fetch('S3_BUCKET').present?\n IMAGE_UPLOAD = true\n\n config.storage = :fog\n config.fog_credentials = {\n provider: 'AWS'...
ruby
chosen
[ { "from": "system", "value": "Switch beauharnois cache to use render.openstreetmap.org\n" }, { "from": "human", "value": "name \"grisu\"\ndescription \"Master role applied to grisu\"\n\ndefault_attributes(\n :accounts => {\n :users => {\n :yellowbkpk => { :status => :administrator }\n ...
ruby
chosen
[ { "from": "system", "value": "Put contents of music dir in @songs\n" }, { "from": "human", "value": "require 'sinatra/base'\n\nclass LSD < Sinatra::Base\n\n MUSIC_DIRECTORY = File.expand_path '~/test_music/'\n\n get '/songs' do\n Dir[MUSIC_DIRECTORY + '/*'].join ' '\n end\n\n get '/' do \...
ruby
chosen
[ { "from": "human", "value": "Add a bm-ips that compares .$$is_number to isNaN()" }, { "from": "gpt", "value": "# Why .$$is_number is better than isNaN:\n#\n#\n# Warming up --------------------------------------\n# .$$is_number 106.722k i/100ms\n# isNaN() 105.040k i/100ms...
ruby
chosen
[ { "from": "system", "value": "Update posts liking spec to find where the count moved to\n\n" }, { "from": "human", "value": "require 'rails_helper'\n\ndescribe 'Likeable', js: true do\n let(:member) { FactoryBot.create(:member) }\n let(:another_member) { FactoryBot.create(:londo...
ruby
chosen
[ { "from": "system", "value": "Fix const redefinition warning in model spec\n" }, { "from": "human", "value": "require 'rails_helper'\n\ndescribe Stagehand::Staging::Model do\n let(:klass) { Klass = Class.new(SourceRecord) }\n\n context 'when included in a model' do\n before { klass.establis...
ruby
chosen
[ { "from": "system", "value": "Edit test to make sure it passes because email was missing.\n" }, { "from": "human", "value": "require 'rails_helper'\n\ndescribe User do\n xit \"should be associated with picks\" do\n user = User.new(:picks => nil)\n user.should_not be_valid\n end\n\n it \...
ruby
chosen
[ { "from": "system", "value": "Replace two login_as methods with a single method\n\nThe default behaviour of login_as_user will login as the stub user,\nelse it will use the defined user.\n" }, { "from": "human", "value": "module AuthenticationControllerHelpers\n def login_as(user)\n request....
ruby
chosen
[ { "from": "system", "value": "Fix name of monitoring role\n" }, { "from": "human", "value": "name 'role_monitoring'\nmaintainer 'Tim Smith'\nmaintainer_email 'tsmith84@gmail.com'\nlicense 'Apache 2.0'\ndescription 'Role cookbook for the monitoring host'\nlong_desc...
ruby
chosen
[ { "from": "human", "value": "Add migration to cleanup iid records\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\nclass DeleteInconsistentInternalIdRecords2 < ActiveRecord::Migration[5.0]\n include Gitlab::Database::MigrationHelpers\n\n DOWNTIME = false\n\n disable_ddl_transac...
ruby
chosen
[ { "from": "system", "value": "Fix Devise flash alert classes\n" }, { "from": "human", "value": "module DeviseHelper\n def devise_error_messages!\n return '' if resource.errors.empty?\n\n messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join\n sentence = I18n...
ruby
chosen
[ { "from": "system", "value": "Update sample to show parameter usage\n" }, { "from": "human", "value": "$: << File.expand_path(\"../../lib\", __FILE__)\n\nrequire 'aws/ec2'\n\n##\n# Expects your Amazon keys to be in the environment, something like\n#\n# export AWS_KEY=\"KEY\"\n# export AWS_SECRET...
ruby
chosen
[ { "from": "system", "value": "Change variable to instance variable\n" }, { "from": "human", "value": "# The main class for the TravisWebhook\nclass KWApi < Sinatra::Base\n get '/test' do\n title = 'Haml Test'\n haml :test\n end\nend\n" }, { "from": "gpt", "value": "# The main...
ruby
chosen
[ { "from": "system", "value": "Update validation test with assoc. constraint\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass CarTest < ActiveSupport::TestCase\n test \"at least one field is filled\" do\n refute Car.new().valid?\n assert Car.new({description: 'A shitty van...
ruby
chosen
[ { "from": "human", "value": "Create file for pairing session\n" }, { "from": "gpt", "value": "# RELEASE 2: NESTED STRUCTURE GOLF\n# Hole 1\n# Target element: \"FORE\"\n\narray = [[1,2], [\"inner\", [\"eagle\", \"par\", [\"FORE\", \"hook\"]]]]\n\n# attempts:\n# ===================================...
ruby
chosen
[ { "from": "system", "value": "Fix for media attachments remote URL download\n" }, { "from": "human", "value": "class MediaAttachment < ApplicationRecord\n belongs_to :account, inverse_of: :media_attachments\n belongs_to :status, inverse_of: :media_attachments\n\n has_attached_file :file\n v...
ruby
chosen
[ { "from": "system", "value": "Add newrelic.yml to load order\n" }, { "from": "human", "value": "RailsConfig.setup do |config|\n config.const_name = \"Settings\"\nend\nActiveSupport.on_load(:before_initialize) do\n # Add other global settings files\n other_files = [\"institutions\", \"sfx_data...
ruby
chosen
[ { "from": "system", "value": "Test the intended error handling of FromYaml more precisely\n" }, { "from": "human", "value": "require 'rails_helper'\nrequire \"#{Rails.root}/lib/from_yaml\"\nrequire \"#{Rails.root}/lib/training_module\"\n\ndescribe FromYaml do\n describe '.load' do\n let(:sub...
ruby
chosen
[ { "from": "system", "value": "Raise if the specs accidentally request the same column twice.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nDB = Sequel.connect(ENV['DATABASE_URL'] || 'postgres:///prelay-test')\n\nDB.extension :pg_json\n\n# Simple way to spec what queries are...
ruby
chosen
[ { "from": "system", "value": "Remove useless default filename definition.\n" }, { "from": "human", "value": "# -*- encoding : utf-8 -*-\nclass BaseUploader < CarrierWave::Uploader::Base\n\n # Include RMagick or ImageScience support\n # include CarrierWave::RMagick\n # include CarrierWave::Ima...
ruby
chosen
[ { "from": "system", "value": "Use Ms for default F salutation\n" }, { "from": "human", "value": "module Renalware\n class Gender\n include ActiveModel::Model\n attr_reader :code\n\n DATA = {\n \"NK\" => \"Not Known\",\n \"M\" => \"Male\",\n \"F\" => \"Female\",\n \"...
ruby
chosen
[ { "from": "system", "value": "Tidy order of attrs in Part" }, { "from": "human", "value": "require 'dry-equalizer'\n\nmodule Dry\n module View\n class Part\n include Dry::Equalizer(:_object, :_renderer, :_context, :_locals)\n\n attr_reader :_object\n attr_reader :_renderer\n ...
ruby
chosen
[ { "from": "system", "value": "Split on hyphen and underscores for job names\n" }, { "from": "human", "value": "module Labor\n module Helpers\n def classify(dashed_word)\n dashed_word.split('-').each { |part| part[0] = part[0].chr.upcase }.join\n end\n\n def constantize(camel_cased...
ruby
chosen
[ { "from": "system", "value": "Fix bug with parameters in the wrong order\n" }, { "from": "human", "value": "require_relative 'colours'\n\nmodule Resume\n class Output\n extend Colours\n\n def self.messages(messages)\n messages.each { |type, key| public_send(key, type) }\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Fix HTTParty json parsing choking in 1.9\n" }, { "from": "human", "value": "require 'httparty'\nmodule ShopifyTheme\n include HTTParty\n\n def self.asset_list\n response = shopify.get(\"/admin/assets.json\")\n assets = JSON.parse(response.body)[\"assets\"].c...
ruby
chosen
[ { "from": "system", "value": "Load in the new contractors\n" }, { "from": "human", "value": "namespace :morph do\n desc \"Get contractors from morph.io api\"\n task :get_contractors => :environment do\n require 'open-uri'\n\n url = \"https://api.morph.io/equivalentideas/westconnex_contra...
ruby
chosen
[ { "from": "human", "value": "Add implementation of thirtieth-second rule of disambiguator prefix\n" }, { "from": "gpt", "value": "module Sastrawi\n module Morphology\n module Disambiguator\n class DisambiguatorPrefixRule32\n def disambiguate(word)\n return 'ajar' if word...
ruby
chosen
[ { "from": "human", "value": "Migrate for Fixing up the javascript to populate the amounts & percents properly when a bucket is selected or if the Funding Line Item's line amount changes.\n" }, { "from": "gpt", "value": "class AddFundingRequestAmountToFundingRequest < ActiveRecord::Migration\n d...
ruby
chosen
[ { "from": "system", "value": "Improve binary search by actually paying attention to the invariant\n" }, { "from": "human", "value": "require 'test/unit'\nextend Test::Unit::Assertions\n\ndef bin_search(a, k)\n offset = 0\n length = a.size\n while length > 0 && offset < a.size\n h...
ruby
chosen
[ { "from": "system", "value": "Change regex to catch multi-line `pubDate` tags.\n" }, { "from": "human", "value": "require \"hbc/system_command\"\n\nmodule Hbc\n class DSL\n class Appcast\n attr_reader :parameters, :checkpoint\n\n def initialize(uri, parameters = {})\n @param...
ruby
chosen