conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use natural width and natural height\n\nUse natural width and natural height to make sure we get the whole image for those that are scaled" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire 'base64'\n\nmodule Watir\n class Image\n def to_x_base64(targ...
ruby
chosen
[ { "from": "human", "value": "Add sample unit testing of a hypothetical Aviator consumer\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\n\nrequire 'rubygems'\nrequire 'bundler/setup'\n\nrequire 'aviator'\n\nclass AviatorConsumer\n\n def do_one_thing\n session = authenticate\n\n keyst...
ruby
chosen
[ { "from": "system", "value": "Add test for hitting author profile page successfully\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass UsersControllerTest < ActionController::TestCase\n test \"should get show\" do\n get :show\n assert_response :success\n end\n\nend\n" },...
ruby
chosen
[ { "from": "system", "value": "Upgrade MacID.app to 1.2.2, add MacOS dependency and zap\n" }, { "from": "human", "value": "cask :v1 => 'macid' do\n version '1.2b'\n sha256 '71dd713f6090b0c6038c274fa32bdb59bb8cfe7f39ec06c252f71dcae932e6a6'\n\n url \"http://macid.co/app/#{version.sub(%r{b.*},'')...
ruby
chosen
[ { "from": "system", "value": "Remove command-key character for compatibility.\n" }, { "from": "human", "value": "require 'formula'\n\nclass Dwm <Formula\n url 'http://dl.suckless.org/dwm/dwm-5.7.2.tar.gz'\n homepage 'http://dwm.suckless.org/'\n md5 'a0b8a799ddc5034dd8a818c9bd76f3a3'\n head '...
ruby
chosen
[ { "from": "system", "value": "Upgrade to 0.5 in podspec\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"Fusuma\"\n s.version = \"0.2.5\"\n s.summary = \"Instagram-like photo browser with a few line of code written in Swift\"\n s.homepage ...
ruby
chosen
[ { "from": "system", "value": "Allow 60s for report deliveries" }, { "from": "human", "value": "BeforeAll do\n Maze.config.receive_no_requests_wait = 15 if Maze.config.respond_to? :receive_no_requests_wait=\nend\n\nBefore('@android_only') do |scenario|\n skip_this_scenario(\"Skipping scenario\"...
ruby
chosen
[ { "from": "system", "value": "Fix problem with not running the shared examples. We should use minitest syntax to define class instead of describe\n" }, { "from": "human", "value": "require 'test_helper'\n\ndescribe \"test that use SharedExamples\" do\n include SharedExampleSpec\nend\n" }, {...
ruby
chosen
[ { "from": "system", "value": "Fix system information page didn't load fluent/version\n" }, { "from": "human", "value": "class MiscController < ApplicationController\n def show\n redirect_to misc_information_path\n end\n\n def information\n @env = ENV\n @plugins = Plugin.installed\n ...
ruby
chosen
[ { "from": "system", "value": "Change walrus to run every hour instead of every 30 minutes\n" }, { "from": "human", "value": "every 1.minute do\n rake 'cron:minutely'\nend\n\nevery 30.minutes do\n rake 'cron:send_undeployed_commits_reminders'\nend\n\nevery 1.hour do\n rake 'cron:rollup'\nend\n...
ruby
chosen
[ { "from": "system", "value": "Make default config folder be /vagrant/etc/config\n" }, { "from": "human", "value": "#\n# Cookbook Name:: sabnzbd\n# Attributes:: default\n#\n\ndefault[\"sabnzbd\"][\"user\"] = 'sabnzbd'\ndefault[\"sabnzbd\"][\"group\"] = 'sabnzbd'\n\ndefault[\"sabnzbd\"][\"director...
ruby
chosen
[ { "from": "system", "value": "Add method payment_method to get the payment method from a payment\n\n - Method `payment_method_name` now use `payment_method`\n" }, { "from": "human", "value": "module Spree\n module PaymentMethodsHelper\n def payment_method_name(payment)\n # hack to allow...
ruby
chosen
[ { "from": "human", "value": "Add Salt Master and Salt API step definitions\n" }, { "from": "gpt", "value": "# Copyright 2015 SUSE LLC\n\nWhen(/^I get a content of a file \"(.*?)\"$/) do |filename|\n $output = sshcmd(\"cat #{filename}\")\nend\n\nThen(/^it should contain \"(.*?)\" text$/) do |con...
ruby
chosen
[ { "from": "system", "value": "Move class matching logic into helper function\n" }, { "from": "human", "value": "# coding: utf-8\n\nmodule ActiveInteraction\n class Base\n # @!method self.model(*attributes, options = {})\n # Creates accessors for the attributes and ensures that values pa...
ruby
chosen
[ { "from": "system", "value": "Allow overriding of entire label for VariableMatches predicate\n" }, { "from": "human", "value": "module SmartAnswer\n module Predicate\n class VariableMatches < Base\n attr_reader :variable_name, :acceptable_responses\n\n def initialize(variable_name,...
ruby
chosen
[ { "from": "system", "value": "Add method to print crosstabs\n" }, { "from": "human", "value": "require 'csv'\n\nclass AnalyzeAssessmentsTable < Struct.new(:path)\n\n def contents\n encoding_options = {\n invalid: :replace,\n undef: :replace,\n replace: ''\n }\n\n @file |...
ruby
chosen
[ { "from": "system", "value": "Implement update user route, remove password and add profile attrs to strong params\n" }, { "from": "human", "value": "class UsersController < ApplicationController\n\n\tdef new\n\t\t@user = User.new\n\tend\n\n\tdef create\n\t\tuser = User.new(user_params)\n\t\tif @...
ruby
chosen
[ { "from": "system", "value": "FIX an incorrect regular expression.\n" }, { "from": "human", "value": "module Embulk\n module Input\n class Presto < InputPlugin\n class ExplainParser\n def self.parse(explain_result)\n explain_text = explain_result.flatten.last.lines.first...
ruby
chosen
[ { "from": "system", "value": "Use bundled version of rubocop\n" }, { "from": "human", "value": "namespace :db do\n namespace :schema do\n task :dump do\n puts \"Dumping database schema with fix-db-schema-conflicts gem\"\n filename = ENV['SCHEMA'] || if defined? ActiveRecord::Tasks:...
ruby
chosen
[ { "from": "system", "value": "Add support for srt mimetype\n" }, { "from": "human", "value": "Mime::Type.register 'application/ogg', :ogg\nMime::Type.register 'application/ogg', :ogx\nMime::Type.register 'video/ogg', :ogv\nMime::Type.register 'audio/ogg', :oga\nMime::Type.register 'video/mp4', :...
ruby
chosen
[ { "from": "system", "value": "Add ability to incorporate history of related content\n" }, { "from": "human", "value": "module PaperTrailScrapbook\n # Class LifeHistory provides Full multi version history\n #\n # @author Timothy Chambers <tim@possibilogy.com>\n #\n class LifeHistory\n def...
ruby
chosen
[ { "from": "system", "value": "Add eligibility status for part 4 non-fishing\n" }, { "from": "human", "value": "class WavesUtilities::EligibilityStatus\n class << self\n def all\n [\n [\"(a) (i) British citizens, or (ii) non-UK nationals exercising their right of freedom of moveme...
ruby
chosen
[ { "from": "system", "value": "Fix message displayed when running \"yk test\"\n\nBefore this commit, the message was:\n\n * Testing some files...\n\nAfter this commit, it is:\n\n * Running testsuite...\n\nMuch better.\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire_relative \"co...
ruby
chosen
[ { "from": "system", "value": "Make sleep_secs an arg (with default).\n" }, { "from": "human", "value": "def wait_for(cmd)\n sleep_secs = 20\n ready = false\n until ready\n sh cmd do |ok, res|\n if ok\n puts \"...ready!\"\n ready = true\n else\n puts \"...not ...
ruby
chosen
[ { "from": "system", "value": "Enable diffmerge git configuration by default (turn off with attribute)\n" }, { "from": "human", "value": "raise \"DiffMerge for Mac only\" unless node[\"platform\"] == \"mac_os_x\"\n\ndmg_package \"DiffMerge\" do\n volumes_dir \"DiffMerge 3.3.2.1139\"\n source \"...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to include test_files\n\nSigned-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)\nrequire 'recommendable/version'\n\nGem::Specification....
ruby
chosen
[ { "from": "system", "value": "Fix problem of lost references to open neo graphs.\n" }, { "from": "human", "value": "module Pacer\n import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jGraph\n import com.tinkerpop.blueprints.pgm.impls.neo4j.Neo4jVertex\n import com.tinkerpop.blueprints.pgm.imp...
ruby
chosen
[ { "from": "system", "value": "Copy MongoMapper initialization from kaminari/hooks.rb\n" }, { "from": "human", "value": "require \"kaminari/mongo_mapper/version\"\n\nmodule Kaminari\n module MongoMapper\n # Your code goes here...\n end\nend\n" }, { "from": "gpt", "value": "requir...
ruby
chosen
[ { "from": "system", "value": "Add missing description to Rake task.\n" }, { "from": "human", "value": "require_relative '../lib/reek/smells/smell_repository'\nrequire 'yaml'\n\nnamespace :configuration do\n task :update_default_configuration do\n DEFAULT_SMELL_CONFIGURATION = 'config/default...
ruby
chosen
[ { "from": "system", "value": "Add an attribute parser helper to Model\n" }, { "from": "human", "value": "require 'cgi'\nrequire 'time'\nrequire 'money'\nrequire 'structure'\n\nrequire 'peddler/parsers/xml'\n\nmodule Peddler\n module Parsers\n class Model < XML\n include Structure\n\n ...
ruby
chosen
[ { "from": "system", "value": "Create method to take in the index_position and symbol and place it on the TTT board\n" }, { "from": "human", "value": "class TicTacToe\n\n attr_accessor :board\n\n def initialize\n @board = Array.new(9, \" \")\n end\n\n def show_board\n puts \" #{@board[0...
ruby
chosen
[ { "from": "system", "value": "Include a redundant templates folder in generator\n" }, { "from": "human", "value": "class RunTemplateGenerator < Rails::Generators::Base\n argument :template_path, :desc => \"Path to an application template\"\n \n def apply_template\n path = template_path\n ...
ruby
chosen
[ { "from": "system", "value": "Add trust to list of platforms\n\nThis change adds ubuntu Trust (14.04) to the list of packaged platform\nartifacts.\n" }, { "from": "human", "value": "# Encoding: utf-8\n# Cloud Foundry Java Buildpack\n# Copyright (c) 2014 the original author or authors.\n#\n# Lice...
ruby
chosen
[ { "from": "system", "value": "Build dummy docker images before spec run\n" }, { "from": "human", "value": "RSpec.configure do |config|\n config.before :suite do\n `docker build --tag nibtest:latest .`\n end\nend\n" }, { "from": "gpt", "value": "RSpec.configure do |config|\n con...
ruby
chosen
[ { "from": "system", "value": "Fix issue with puma attributes, they should be defined per application not globally\n" }, { "from": "human", "value": "ruby_block \"ensure only our unicorn version is installed by deinstalling any other version\" do\n block do\n ensure_only_gem_version('puma', n...
ruby
chosen
[ { "from": "human", "value": "Add basic feature spec for private courses\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\n\nrequire 'rails_helper'\n\ndescribe 'Private courses' do\n let(:course) { create(:course, private: true) }\n let(:user) { create(:user) }\n before do\n l...
ruby
chosen
[ { "from": "system", "value": "Modify stub_login to use mocha mocks\n" }, { "from": "human", "value": "module AuthenticationHelper\n\n\tdef valid_signin(user, password)\n\t\tvisit login_path\n\t\tfill_in \"Email\", with: user.email\n\t\tfill_in \"Password\", with: password\n\t\tclick_button \"Log...
ruby
chosen
[ { "from": "system", "value": "Fix VCR record mode overriding.\n" }, { "from": "human", "value": "shared_context 'API request', :resource do\n let(:client) { PewPew::Client.new }\n\n around do |example|\n client.configure do |config|\n config.api_key = ENV['MAILGUN_API_KEY']\n conf...
ruby
chosen
[ { "from": "system", "value": "Package version increased from 0.4.5.1 to 0.4.5.2\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'schema'\n s.summary = \"Primitives for schema and structure\"\n s.version = '0.4.5.1'\n s.description = ' '\...
ruby
chosen
[ { "from": "system", "value": "821: Fix select2 label attr for signup households\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Meals\n class SignupDecorator < ApplicationDecorator\n delegate_all\n\n def household_name\n household.nil? ? \"\" : household.de...
ruby
chosen
[ { "from": "system", "value": "Use `if` blocks instead of two ternary operators\n\nUsing a simple ternary operator is usually fine; however, code combining\ntwo ternary operator is a bit hard to follow.\n" }, { "from": "human", "value": "module BudgetInvestmentsHelper\n def budget_investments_ad...
ruby
chosen
[ { "from": "system", "value": "Drop \"action\" and \"controller\" params from URLs\n\nAlways accessible via `params[\"action\"]` and `params[\"controller\"]`\n" }, { "from": "human", "value": "module Orchid::ApplicationHelper\n\n def copy_params\n return params.to_unsafe_h\n end\n\n def cle...
ruby
chosen
[ { "from": "system", "value": "Use a get request rather than post request in spec.\n" }, { "from": "human", "value": "require 'spec_helper'\n\nRSpec.describe SeeYourRequests do\n\n context 'HTTP methods' do\n before do\n $stdout = StringIO.new\n end\n\n it 'returns 200 status for g...
ruby
chosen
[ { "from": "system", "value": "Add osx deployment target to podspec.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'TinyConstraints'\n s.version = '3.1.0'\n s.ios.deployment_target = '9.0'\n s.tvos.deployment_target = '9.0'\n s.summary = 'Nothing but su...
ruby
chosen
[ { "from": "system", "value": "Remove test for \"gem install nokogiri\"\n\nThe remaining gem install test already tests everything,\nso that nokogiri is not very valuable here.\n" }, { "from": "human", "value": "require \"minitest/autorun\"\n\nclass TestGemInstall < Minitest::Test\n def test_gem...
ruby
chosen
[ { "from": "system", "value": "Add JSON as an inflection\n\nRails camel cases the filename to work out the expected class name. In\nthis case, `symbolize_json.rb` was expected to be `SymbolizeJson`.\n\nAdding an acronym as an inflection will resolve this.\n" }, { "from": "human", "value": "# Be s...
ruby
chosen
[ { "from": "system", "value": "Bring back address picking via param\n\nOriginally checked in 753c650e1e471f21215e480d198384c61856eb61 and lost\nlater on in 7c5e414b083b41253fbb19fcb08dcc6e8345e1c9\n" }, { "from": "human", "value": "class Order\n def initialize(order_hash)\n @order_hash = orde...
ruby
chosen
[ { "from": "system", "value": "Update henson install spec to check if path sourced modules use symlinks\n" }, { "from": "human", "value": "require \"acceptance_spec_helper\"\n\ndescribe \"henson install\" do\n let(:project) do\n File.expand_path(\"../fixtures\", __FILE__)\n end\n\n before(:...
ruby
chosen
[ { "from": "system", "value": "Add license information to gemspec.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nGem::Specification.new do |gem|\n gem.name = 'actionpack-action_caching'\n gem.version = '1.1.0'\n gem.author = 'David Heinemeier Hansson'\n ...
ruby
chosen
[ { "from": "system", "value": "Revert \"break acceptance spec, this should make a screenshot\"\n\nThis reverts commit c40f2556e42fc8f84dae00983051aec74bc81ae6.\n" }, { "from": "human", "value": "require 'acceptance_helper'\n\ndescribe \"channels\", type: :request do\n it \"can be visited\" do\n ...
ruby
chosen
[ { "from": "system", "value": "Add test code for `ransacker :full_name`\n" }, { "from": "human", "value": "describe Comable::Address do\n it { is_expected.to belong_to(:user).class_name(Comable::User.name).autosave(false) }\n\n it { is_expected.to validate_presence_of(:family_name) }\n it { is...
ruby
chosen
[ { "from": "system", "value": "Remove milestone observer from db fixture.\n" }, { "from": "human", "value": "ActiveRecord::Base.observers.disable(:milestone_observer)\n\nMilestone.seed(:id, [\n { id: 1, project_id: 1, title: 'v' + Faker::Address.zip_code },\n { id: 2, project_id: 1, title: 'v...
ruby
chosen
[ { "from": "system", "value": "Add proper before/after blocks for a File.socket? spec\n" }, { "from": "human", "value": "require File.expand_path('../../../spec_helper', __FILE__)\nrequire File.expand_path('../../../shared/file/socket', __FILE__)\nrequire 'socket'\n\ndescribe \"File.socket?\" do\...
ruby
chosen
[ { "from": "human", "value": "Convert cucumber nodes-feature to rspec-feature\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\ndescribe \"Nodes Feature\" do\n\n describe 'Find, update and create nodes via API' do\n\n before do\n # Given a provider \"stiftung\" exists with name:...
ruby
chosen
[ { "from": "system", "value": "Change to new icons again\n\naccidentally regressed in merge\n" }, { "from": "human", "value": "module ApplicationHelper\n \n def new_session_path(scope)\n new_user_session_path\n end\n \n def row_class(pr)\n case pr.state\n when 'passed', 'agreed'...
ruby
chosen
[ { "from": "system", "value": "Handle html tags in page_heading helper.\n" }, { "from": "human", "value": "module ApplicationHelper\n def set_title(title)\n content_for :title, title\n end\n\n def page_heading(tag, heading)\n set_title heading\n content_tag tag, heading\n end\nend\n"...
ruby
chosen
[ { "from": "system", "value": "Fix table.content width rendering bug in application helper\n" }, { "from": "human", "value": "require 'benchmark'\n\nmodule ApplicationHelper\n def benchmark\n @benchmark ||= Time.now\n end\n\n def width_override(width)\n width.nil? ? nil : \"width: #{widt...
ruby
chosen
[ { "from": "system", "value": "Make sure methods checks for ramsar instance\n" }, { "from": "human", "value": "module ApplicationHelper\n def is_ramsar_instance?\n Rails.root.to_s.include?('API')\n end\nend\n" }, { "from": "gpt", "value": "module ApplicationHelper\n def is_ramsa...
ruby
chosen
[ { "from": "system", "value": "Add EOL to ability spec.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Ability do\n context \"as singleton\" do\n roles = Ability.roles\n roles_collection = Ability.roles_for_collection\n roles.should == ['admin', 'accountant']\n ...
ruby
chosen
[ { "from": "human", "value": "Add a basic test for RabbitMQ\n\nBasic test to see if RabbitMQ is up and running.\n" }, { "from": "gpt", "value": "#\n# Copyright (C) 2015 Red Hat, Inc.\n#\n# Author: Martin Magr <mmagr@redhat.com>\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"...
ruby
chosen
[ { "from": "system", "value": "AndreasTolfTolfsen: Make sure remote server is shut down before running specs on Selenium::WebDriver::Opera\n\ngit-svn-id: aa1aa1384423cb28c2b1e29129bb3a91de1d9196@13920 07704840-8298-11de-bf8c-fd130f914ac9\n" }, { "from": "human", "value": "module Selenium\n modul...
ruby
chosen
[ { "from": "system", "value": "Add homepage and fix dependecy call\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'encrypted_params/version'\n\nGem::Specification.new do |spec|\n spe...
ruby
chosen
[ { "from": "human", "value": "Create migration for removing Type / Template/VMs filters\n\nhttps://bugzilla.redhat.com/show_bug.cgi?id=1351210\n\nMigration for removing Type / Template/VMs filters\nfrom MiqSearch to fix the bug because the filters\nwere useless in VMS filters.\n" }, { "from": "gpt", ...
ruby
chosen
[ { "from": "system", "value": "Handle pop for loaded_features properly\n" }, { "from": "human", "value": "# -*- encoding: us-ascii -*-\n\nmodule Rubinius\n\n # LoadedFeatures is a custom class for $LOADED_FEATURES. It presents an\n # Array interface but maintains an Array::IdentityMap for close...
ruby
chosen
[ { "from": "system", "value": "Use less frequently updated artist\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass ArtistControllerTest < ActionController::TestCase\n test \"list of artists\" do\n get \"index\"\n assert_response 200\n assert_select %Q[a:contains(\"Steve...
ruby
chosen
[ { "from": "system", "value": "Add missing steps as pending\n\n0:05\n" }, { "from": "human", "value": "Given /^there is an event in Eventbrite$/ do\nend\n\nWhen /^I sign up to that event and ask to be invoiced$/ do\n # Set up some user details\nend\n\nThen /^I should be marked as wanting an invo...
ruby
chosen
[ { "from": "system", "value": "Add code to run the Parser\n" }, { "from": "human", "value": "require_relative './lib/scraper.rb'\nrequire_relative './lib/parser.rb'\n\n# years = (2002..2014)\n# years.each_with_index do |yr, i|\n# rush = Scraper.new('rushing', yr)\n# pass = Scraper.new('passin...
ruby
chosen
[ { "from": "system", "value": "Use FileUtils for all file operations. Also uses Kernel.system to execute shell commands in a secure fashion.\n" }, { "from": "human", "value": "module PhotoMover\n\n def self.move_photos(user)\n\n Dir.chdir Rails.root\n temp_dir = \"tmp/exports/#{user.id}\"\...
ruby
chosen
[ { "from": "system", "value": "Make `ActiveRecord::Migrator` idempotent again in test env\n" }, { "from": "human", "value": "if Rails.env.test?\n require 'active_record/migration'\n\n module ActiveRecord\n class Migrator\n class << self\n alias_method :migrations_unmemoized, :mig...
ruby
chosen
[ { "from": "system", "value": "Sort legend on diversity pies alphabetically\n" }, { "from": "human", "value": "class DiversityDashboard < MetricsHelper\n \n def self.gender_total\n data = []\n (load_metric 'diversity-gender')['value']['total'].each_pair do |gender, value|\n data << {...
ruby
chosen
[ { "from": "system", "value": "Allow client-specified handling of results.\n" }, { "from": "human", "value": "require 'spinoza/system/node'\nrequire 'spinoza/calvin/sequencer'\nrequire 'spinoza/calvin/scheduler'\n\nclass Calvin::Node < Spinoza::Node\n attr_reader :sequencer, :scheduler\n attr_r...
ruby
chosen
[ { "from": "system", "value": "Add rake as dev dependency.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"loadable_component/version\"\n\nGem::Specification.new do |s|\n s.name = \"loadable_component\"\n s.version ...
ruby
chosen
[ { "from": "system", "value": "Add locale to the delegated method list\n" }, { "from": "human", "value": "require 'active_support/concern'\n\nmodule Georgia\n module Concerns\n module Contentable\n extend ActiveSupport::Concern\n\n included do\n has_many :contents, as: :conte...
ruby
chosen
[ { "from": "system", "value": "Add test to ensure Core does not log\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\ndescribe 'meta', chdir: false do\n example do\n regular_files = Dir['lib/nanoc/core/**/*.rb']\n regular_file_base_names = regular_files.map { |fn| fn.gsub...
ruby
chosen
[ { "from": "system", "value": "Speed up counting by using a JOIN\n\nNote this will double count disk usage as it doesn't take into account\nthe fact that attachments are re-attached to each subsequent edition.\n" }, { "from": "human", "value": "# Calculates average file size per attachment,\n# An...
ruby
chosen
[ { "from": "human", "value": "Define an Atom view (using the Atom builder)\n" }, { "from": "gpt", "value": "atom_feed do |feed|\n feed.title \"Who bought #{@product.title}\"\n \n feed.updated @latest_order.try(:updated_at) \n \n @product.orders.each do |order|\n feed.entry(order) do |entry|...
ruby
chosen
[ { "from": "system", "value": "Add a class to represent negated objects for events\n" }, { "from": "human", "value": "require 'discordrb/events/utility'\n\nmodule Discordrb::Events\n class EventHandler\n include Discordrb::Events::Utility\n def initialize(attributes, block)\n @attribu...
ruby
chosen
[ { "from": "system", "value": "Add warning for missing validation if database isn't present.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire \"active_model/errors\"\nrequire \"active_record/errors\"\n\nclass Gutentag::TagValidations\n DEFAULTS = {\n :presence => ...
ruby
chosen
[ { "from": "system", "value": "Remove old command to run for nginx\n" }, { "from": "human", "value": "Capistrano::Configuration.instance(:must_exist).load do\n\n after 'deploy:create_symlink', 'nginx:configure'\n\n namespace :nginx do\n\n desc 'Add app configuration for Mirego infrastructure...
ruby
chosen
[ { "from": "system", "value": "Remove cc and bcc. Use bcc.\n" }, { "from": "human", "value": "module MailsocioRails\n class Delivery < ::Mail::SMTP\n attr_accessor :settings\n def initialize(settings)\n self.settings = default_settings.merge settings\n end\n\n def deliver!(mail)...
ruby
chosen
[ { "from": "system", "value": "Use more meaningful variable name\n\ntmp ->\nparams\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe RegexpPreview::MultiLine do\n describe \"#matches_json\" do\n subject { RegexpPreview::MultiLine.new(File.expand_path(\"./spec/support/fix...
ruby
chosen
[ { "from": "system", "value": "Make Gson adapter explicitly read StringIO object\n" }, { "from": "human", "value": "require 'gson'\nrequire 'multi_json/adapter'\n\nmodule MultiJson\n module Adapters\n # Use the gson.rb library to dump/load.\n class Gson < Adapter\n ParseError = ::Gson...
ruby
chosen
[ { "from": "system", "value": "Allow a third party to stop and start Tropo1's DRb service" }, { "from": "human", "value": "module RSpecRayo\n class Tropo1Driver\n require 'net/http'\n require 'uri'\n require 'countdownlatch'\n\n attr_accessor :script_content, :result, :drb, :config\n...
ruby
chosen
[ { "from": "system", "value": "Remove upper limit for ruby\n\nIt's not very useful but a hassle to update yearly.\n" }, { "from": "human", "value": "require File.expand_path('../lib/rack/dev-mark/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = \"rack-dev-mark\"\n gem....
ruby
chosen
[ { "from": "system", "value": "Add attributes to the Customer class\n" }, { "from": "human", "value": "module WavesUtilities\n class Customer\n attr_accessor(\n :id,\n :name,\n :address_1,\n :address_2,\n :address_3,\n :town,\n :county,\n :postcode,\n ...
ruby
chosen
[ { "from": "system", "value": "Update the login step definitions for out new way to fake a login\n" }, { "from": "human", "value": "Given(/^I am logged in$/) do\n ENV['PDS_HANDLE'] = 'PDS_HANDLE'\nend\n\nGiven(/^I am not logged in$/) do\n ENV['PDS_HANDLE'] = nil\nend\n\nThen(/^I should see a lo...
ruby
chosen
[ { "from": "system", "value": "Fix MD5 sum for Gist\n\nSigned-off-by: Adam Vandenberg <34c2b6407fd5a10249a15d699d40f9ed1782e98c@gmail.com>\n" }, { "from": "human", "value": "require 'formula'\n\nclass Gist < Formula\n url 'https://github.com/defunkt/gist/tarball/v2.0.3'\n homepage 'https://gith...
ruby
chosen
[ { "from": "human", "value": "Add migration for deleted tweets table.\n" }, { "from": "gpt", "value": "class AddDeletedTweetsTable < ActiveRecord::Migration\n def self.up\n execute \"CREATE TABLE `deleted_tweets` LIKE `tweets`\"\n execute \"INSERT INTO `deleted_tweets` SELECT * FROM `tweet...
ruby
chosen
[ { "from": "system", "value": "Add reference to logic to ontology version\n" }, { "from": "human", "value": "class CreateOntologyVersions < ActiveRecord::Migration\n def change\n create_table :ontology_versions do |t|\n t.references :user, :null => false\n t.references :ontology, :n...
ruby
chosen
[ { "from": "system", "value": "Revert add action follow up 2\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nclass AddIndexToDeployments < ActiveRecord::Migration\n include Gitlab::Database::MigrationHelpers\n\n DOWNTIME = false\n\n disable_ddl_transaction!\n\n def up\n ...
ruby
chosen
[ { "from": "system", "value": "Remove extra comments, and use current_user instead of @current_user\n" }, { "from": "human", "value": "module Spree\n module Admin\n class ProductImportsController < BaseController\n\n #Sorry for not using resource_controller railsdog - I wanted to, but th...
ruby
chosen
[ { "from": "system", "value": "Add access to block_children of if/unless_match\n" }, { "from": "human", "value": "class Flow::Action::IfMatch < Flow::Action\n def setup_with_flow!(field, value=Flow::DEFAULT_ARGUMENT, &block)\n @field = field\n @value = value\n new_flow = flow.clone_with...
ruby
chosen
[ { "from": "system", "value": "Fix setting default hex color input\n" }, { "from": "human", "value": "class ColorInput < SimpleForm::Inputs::Base\n def input(wrapper_options)\n hex_code = object.try(attribute_name).presence || options.delete(:hex_code).presence || default_hex_code\n merged...
ruby
chosen
[ { "from": "system", "value": "Fix spec due to removed context\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe RdbBoard do\n fixtures :projects\n\n let(:board) do\n RdbBoard.create \\\n context: Project.find(1),\n engine: Rdb::Taskboard,\n name: 'Test Boar...
ruby
chosen
[ { "from": "system", "value": "Return nil on methods trying to perform invalid pagination\n" }, { "from": "human", "value": "class SkroutzApi::PaginatedCollection < Array\n include SkroutzApi::Parsing\n\n delegate :model_name, :client, to: :context\n\n attr_reader :response, :context\n\n def ...
ruby
chosen
[ { "from": "system", "value": "Index and Form dialog box controllers are added to the scaffold generator.\n" }, { "from": "human", "value": "require 'generators/angular'\nrequire 'rails/generators/generated_attribute'\n\nmodule Angular\n module Generators\n class ScaffoldGenerator < Base\n ...
ruby
chosen
[ { "from": "system", "value": "Remove explicit return and replace with a next.\n\nFixes `Non-local exit from iterator, without return value.`\n" }, { "from": "human", "value": "PuppetLint.new_check(:duplicate_class_parameters) do\n def check\n class_indexes.each do |class_idx|\n seen = H...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary find user method\n" }, { "from": "human", "value": "class ExpensesheetsController < ApplicationController\n\n def new\n @expenses = Expense.new\n end\n\n def show\n @expenses = Expense.snapshot(@user.expenses, @user.income)\n end\n\n de...
ruby
chosen
[ { "from": "system", "value": "Update omniauth-oauth2 to version 1.7.0" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire File.expand_path('lib/omniauth/vkontakte/version', __dir__)\n\nGem::Specification.new do |gem|\n gem.authors = ['Anton Maminov']\n gem.email ...
ruby
chosen
[ { "from": "system", "value": "Reorder shell direction so 2 is actually appended to 1\n" }, { "from": "human", "value": "def silent_system(cmd)\n silent_cmd = cmd + \" 2>&1 > /dev/null\"\n system(silent_cmd)\nend\n" }, { "from": "gpt", "value": "def silent_system(cmd)\n silent_cmd ...
ruby
chosen