conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Enable to set root directory to clone gems with an environment var\n" }, { "from": "human", "value": "require 'rubygems'\n\nGem.post_install do |installer|\n clone_dir = \"#{installer.gem_dir}/src\"\n\n if (repo = installer.spec.homepage) && !repo.empty? && !File....
ruby
chosen
[ { "from": "system", "value": "Make \"rake\" depend on \"rake db:test:prepare\".\n\nThis also tests for pending migrations.\n" }, { "from": "human", "value": "require 'rake'\nbegin\n require 'rspec/core/rake_task'\n task(:spec).clear\n RSpec::Core::RakeTask.new(:spec) do |t|\n t.verbose = f...
ruby
chosen
[ { "from": "system", "value": "Add default value for keyword argument\n" }, { "from": "human", "value": "module SameBoat\n class Crews\n def initialize(crews, journal_path:)\n @crews, @journal_path = crews, journal_path\n end\n\n def row\n call_over == past_travel\n end\n\n...
ruby
chosen
[ { "from": "system", "value": "Add rake to development dependencies\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"license_finder/version\"\n\nGem::Specification.new do |s|\n s.name = \"license_finder\"\n s.version ...
ruby
chosen
[ { "from": "human", "value": "Add migration for render_as_partial_for_layout toggle\n" }, { "from": "gpt", "value": "class AddRenderAsPartialForLayoutForSpreePages < ActiveRecord::Migration\n def up\n unless column_exists? :spree_pages, :render_layout_as_partial\n add_column :spree_pages...
ruby
chosen
[ { "from": "system", "value": "Remove all references to on_hand\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Spree::LineItem do\n let(:order) { create :order_with_line_items, line_items_count: 1 }\n let(:line_item) { order.line_items.first }\n before do\n Spree::Conf...
ruby
chosen
[ { "from": "system", "value": "Add debugger as development dependency.\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"link_to_action/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.n...
ruby
chosen
[ { "from": "system", "value": "Refactor the mess out of a test\n" }, { "from": "human", "value": "require 'spec_helper'\n\nclass HomeClass\n include HomeHelper\nend\ndescribe HomeHelper do\n context \"Included in a class\" do\n subject { HomeClass.new }\n\n describe \"#get_completed_test_...
ruby
chosen
[ { "from": "human", "value": "Add routing spec for calculators" }, { "from": "gpt", "value": "RSpec.describe 'Calculator routing', type: :routing do\n it 'routes /take-whole-pot/estimate to calculators/take_whole_pot#show' do\n expect(get('/take-whole-pot/estimate'))\n .to route_to(contr...
ruby
chosen
[ { "from": "system", "value": "Remove active resource require because we are not using it\n" }, { "from": "human", "value": "# encoding: utf-8\nrequire 'rspec'\nrequire 'rspec_tag_matchers'\n\nRSpec.configure do |config|\n config.include RspecTagMatchers\n config.include CustomMacros\n config....
ruby
chosen
[ { "from": "system", "value": "Fix syntax error in podspec.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"TSMessages\"\n s.version = \"0.9.4\"\n s.summary = \"Easy to use and customizable messages/notifications for iOS à la Tweetbot.\"\n s.description ...
ruby
chosen
[ { "from": "system", "value": "Add reversed geocoding support for Ovi/Nokia\n" }, { "from": "human", "value": "require 'geocoder/lookups/base'\nrequire 'geocoder/results/ovi'\n\nmodule Geocoder::Lookup\n class Ovi < Base\n\n def name\n \"Ovi\"\n end\n\n def required_api_key_parts\n...
ruby
chosen
[ { "from": "system", "value": "Use the pre-Ruby 2.4 method for element attribute access for backwards compatibility.\n" }, { "from": "human", "value": "\nrequire 'rexml/document'\nrequire GitHooks.shared_path('git_hooks/violation')\nrequire GitHooks.shared_path('git_hooks/violations')\n\nmodule G...
ruby
chosen
[ { "from": "system", "value": "Optimize runs of Index to ChainIndex\n" }, { "from": "human", "value": "module JMESPath\n # @api private\n module Nodes\n class Index < Node\n def initialize(index)\n @index = index\n end\n\n def visit(value)\n if Array === value\n ...
ruby
chosen
[ { "from": "system", "value": "Add defined hook when content type is created\n" }, { "from": "human", "value": "class Kekomi\n\n class ContentTypes\n \n def self.base\n @_base\n end\n\n def self.base=(base)\n @_base = base\n end\n\n def self.add(name, &block)\n n...
ruby
chosen
[ { "from": "system", "value": "Add missing coercions to error-related properties on base object\n" }, { "from": "human", "value": "require \"openlogi/errors\"\n\nmodule Openlogi\n class BaseObject < Hashie::Dash\n include Hashie::Extensions::Dash::Coercion\n include Hashie::Extensions::Mer...
ruby
chosen
[ { "from": "system", "value": "Add comment for unresolved behavior\n\nI don't know now.\n" }, { "from": "human", "value": "require 'daimon_skycrawlers/crawler'\nrequire 'daimon_skycrawlers/processor'\n\nmodule DaimonSkycrawlers\n class URLConsumer\n include SongkickQueue::Consumer\n\n cons...
ruby
chosen
[ { "from": "system", "value": "Move ansible version back to latest since release of 1.7\n" }, { "from": "human", "value": "def build_protobox(yaml, protobox_dir)\n ansible_version_file = protobox_dir + '/ansible_version'\n\n # Ansible version\n ansible_version = '1.6.8'\n #if !yaml['protobox'...
ruby
chosen
[ { "from": "human", "value": "Add rake task to tag content from a remote CSV file\n" }, { "from": "gpt", "value": "desc \"Perform taggings from a csv file\"\ntask :tag_from_csv, [:csv_url] => :environment do |_, args|\n Tagging::CsvTagger.do_tagging(args[:csv_url]) do |tagging|\n puts \"Taggi...
ruby
chosen
[ { "from": "system", "value": "Add public instance method summary view to class generator\n" }, { "from": "human", "value": "module YARD\n module Generators\n class ClassGenerator < Base\n def sections_for(object) \n [\n :header,\n [\n InheritanceGener...
ruby
chosen
[ { "from": "system", "value": "Make event parsable by yardoc\n" }, { "from": "human", "value": "require 'cucumber/core/events'\n\nmodule Cucumber\n module Events\n\n # Event fired after aall test cases have finished executing\n TestRunFinished = Class.new(Core::Event.new)\n\n end\nend\n" ...
ruby
chosen
[ { "from": "system", "value": "Add published and unpublished functions\n" }, { "from": "human", "value": "class Post < ActiveRecord::Base\n belongs_to :author, class_name: :user, foreign_key: :author_id\nend\n" }, { "from": "gpt", "value": "class Post < ActiveRecord::Base\n belongs_...
ruby
chosen
[ { "from": "system", "value": "Make begin, rescue, end blocks\n" }, { "from": "human", "value": "module Intrinsic::Intrinsicism\n module Validation\n\n attr_reader :validators, :errors\n\n def self.included(subject)\n super\n subject.extend Validation\n end\n\n def validati...
ruby
chosen
[ { "from": "system", "value": "Raise an RecordNotFound error on Stop.find_legacy" }, { "from": "human", "value": "class Stop < ActiveRecord::Base\n acts_as_mappable(lat_column_name: :latitude, lng_column_name: :longitude)\n has_many :stop_times\n has_many :trips, through: :stop_times\n has_ma...
ruby
chosen
[ { "from": "system", "value": "Trim out devise options comment\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n # Include default devise modules. Others available are:\n # :token_authenticatable, :confirmable, :lockable and :timeoutable\n devise :database_authenticatable, :...
ruby
chosen
[ { "from": "system", "value": "Refactor roles method to avoid creating temp array every time is called\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n has_many :startups\n # Include default devise modules. Others available are:\n # :token_authenticatable, :confirmable,\n ...
ruby
chosen
[ { "from": "system", "value": "Update rom dep in gemspec\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire File.expand_path('../lib/rom/repository/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = 'rom-repository'\n gem.summary = 'Repository for RO...
ruby
chosen
[ { "from": "system", "value": "Update specs from prior pull request to work with generic sendgrid URI as implemented before merge.\n" }, { "from": "human", "value": "require File.expand_path(\"#{File.dirname(__FILE__)}/../../helper\")\n\ndescribe SendgridToolkit::Common do\n\n before do\n cla...
ruby
chosen
[ { "from": "system", "value": "Include all restful actions in controller template\n" }, { "from": "human", "value": "module Admin\n\tclass <%= resource_name.classify %>Controller < Shadmin::ApplicationController\n\t\t# def index\n\t\t# end\n\tend\nend" }, { "from": "gpt", "value": "mo...
ruby
chosen
[ { "from": "system", "value": "Add extra specifications for automatic `path` suffix and requiring that the stem be a symbol.\n" }, { "from": "human", "value": "require 'rails_helper'\n\ndescribe 'form_for resource', type: :view do\n let(:instance) { Instance.default }\n with_tenant(:instance) d...
ruby
chosen
[ { "from": "system", "value": "Fix a typo in the test for copyartifact\n" }, { "from": "human", "value": "require_relative \"../test_helper\"\n\nclass BuildersTest < Minitest::Test\n include Jujube::Components\n\n def test_shell\n expected = {'shell' => 'COMMAND'}\n assert_equal(expected,...
ruby
chosen
[ { "from": "system", "value": "Add Devise's helpers to View specs as suggested\n" }, { "from": "human", "value": "RSpec.configure do |config|\n # Add Devise's helpers for controller tests\n config.include Devise::Test::ControllerHelpers, type: :controller\nend\n" }, { "from": "gpt", ...
ruby
chosen
[ { "from": "system", "value": "Add regression test for raw tags with open variable tags.\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass RawTagTest < Test::Unit::TestCase\n include Liquid\n\n def test_tag_in_raw\n assert_template_result '{% comment %} test {% endcomment %}'...
ruby
chosen
[ { "from": "human", "value": "Remove FK constraints for possibly global RA ids\n\nroot_account_id on these tables can be cross-shard, so cannot have an FK\nconstraint.\n\nTest plan:\n- run migration and make sure you can set root_account_id to a global ID e.g.\n 10000000000001 on an Attachment, AttachmentAs...
ruby
chosen
[ { "from": "system", "value": "Fix html escaping in some titles.\n" }, { "from": "human", "value": "module ApplicationHelper\n def set_title(title)\n content_for :title, strip_tags(title)\n end\n\n def page_heading(tag, heading)\n set_title heading\n content_tag tag, heading.html_safe...
ruby
chosen
[ { "from": "system", "value": "Fix languages list to work even if fallbacks is disabled" }, { "from": "human", "value": "module ApplicationHelper\n\n def nav_link\n render :partial => \"shared/navi_link\", :locals => {}\n end\n\n def languages\n I18n.fallbacks.keys.concat(I18n.available_...
ruby
chosen
[ { "from": "system", "value": "Fix typos in comments [ci skip]\n" }, { "from": "human", "value": "module SafeParamsHelper\n # Rails 5.0 requires to permit parameters if used in url helpers.\n # User this helper when generating links with `params.merge(...)`\n def safe_params\n if params.res...
ruby
chosen
[ { "from": "system", "value": "Validate the user association instead\n" }, { "from": "human", "value": "class ArticleEndorsement < ApplicationRecord\n include Dateable\n\n belongs_to :article, counter_cache: :endorsements_count\n belongs_to :user\n\n after_create :send_endorsement\n\n valida...
ruby
chosen
[ { "from": "system", "value": "Use 'require', not 'require_dependency' in extract_emails\n" }, { "from": "human", "value": "require_dependency 'extract_emails'\n\nclass Project\n\n # array of user IDs\n attr_accessor :invite_users\n # string with email addresses\n attr_accessor :invite_emails...
ruby
chosen
[ { "from": "system", "value": "Refactor collapse comments end-to-end test\n\nTo:\n- Better separate scopes (pre-conditions on before, tests on it)\n- Remove unnecessary expectation\n- Replace other unnecessary expectations by page.assert_text\n- Move variables closer to where they're used\n" }, { "fr...
ruby
chosen
[ { "from": "system", "value": "Include ItemsHelper within ApplicationController so that the entire application has access to finding items\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery with: :exception\n include SessionsHelper\nen...
ruby
chosen
[ { "from": "system", "value": "Select only public repositories and commits of\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery\n helper_method :login_required\n before_filter :set_our_current_user\n\n def index\n @repositories =...
ruby
chosen
[ { "from": "system", "value": "Disable CSRF for JSON API\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want to use :null_session instead.\n protect_from_forgery with: :exception\n ...
ruby
chosen
[ { "from": "system", "value": "Add current user to sentry\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n respond_to :json, :html\n include Tokenizeable\n protect_from_forgery with: :exception\n devise_group :user, contains: [:developer, :recruiter]\n...
ruby
chosen
[ { "from": "system", "value": "Write nicer unauthorized flash message\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n\n# before_filter :authenticate_user!\n\n include Pundit\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want t...
ruby
chosen
[ { "from": "system", "value": "Switch to shared token parser.\n" }, { "from": "human", "value": "class NewslettersController < ApplicationController\n skip_before_action :verify_authenticity_token\n skip_before_action :authorize, only: [:create]\n\n def create\n newsletter = Newsletter.new(...
ruby
chosen
[ { "from": "system", "value": "Change wording of hints on consultation forms\n\nAfter discussion with Alice, we think this wording is more succinct. The\nkey concern is to alert people to the fact that they can upload\nattachments on the next page, so a shorter message gives more chance\nthat they'll read th...
ruby
chosen
[ { "from": "system", "value": "Fix delivery of alliance confirmations\n" }, { "from": "human", "value": "class AlliancesController < ApplicationController\n\n def index\n @alliances = Alliance.all\n respond_to do |format|\n format.html\n format.fragment { render \"index\", format...
ruby
chosen
[ { "from": "system", "value": "Clean up delete a little\n" }, { "from": "human", "value": "class GameplaysController < ApplicationController\n def create\n @night = Night.find(params[:night_id])\n @gameplay = @night.gameplays.build(params[:gameplay].permit(:game_id,:status,:notes,:finished...
ruby
chosen
[ { "from": "system", "value": "Kill any previous speech process before starting a new one.\n" }, { "from": "human", "value": "require './cerevoice.rb'\n\nclass TimerUI\n class Speech\n def initialize(username, password)\n @cerevoice = CereVoice.new(username, password, \"speech_cache\")\n...
ruby
chosen
[ { "from": "system", "value": "Make syntax Ruby 1.8 compatible.\n" }, { "from": "human", "value": "# vim: fileencoding=UTF-8 ft=ruby syn=ruby ts=2 sw=2 ai eol et si\n\n# Copyright (c) 2009 Jörg W Mittag <mailto:JoergWMittag+Link-List@GoogleMail.Com>\n# This code is licensed under the terms of the...
ruby
chosen
[ { "from": "human", "value": "Build entities map from W3C DTD.\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\nrequire 'open-uri'\nrequire 'uri'\n\nDTD_URI = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'\nentities = {}\n\ndtd = open(DTD_URI){ |io| io.read }\ndtd.scan(/<!ENTITY \\s+ % ...
ruby
chosen
[ { "from": "system", "value": "Remove 2 dependencies on provides_service and mountable_volumes from zookeeper. These just don't exist anywhere and they break bulk cookbook uploads\n\n\nFormer-commit-id: f768344564a6ce0797f36da723c754f01cc60805" }, { "from": "human", "value": "maintainer \"...
ruby
chosen
[ { "from": "system", "value": "Abort the script with an error signal if the template file doesn't seem to exist\n" }, { "from": "human", "value": "#! /usr/bin/ruby\r\n\r\nrequire 'parseconfig'\r\n\r\nconfig = ParseConfig.new(ARGV[0])\r\ntemplate_file = config['template_file']\r\nunless File.file?...
ruby
chosen
[ { "from": "system", "value": "Fix test not reflecting a real scenario\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'spec_helper'\n\ndescribe FrontMatterParser::Loader::Yaml do\n describe '::call' do\n it 'loads using yaml parser' do\n string = \"{title: 'h...
ruby
chosen
[ { "from": "system", "value": "Add error classes for not found resources and failed responses.\n" }, { "from": "human", "value": "module Acfs\n\n # Acfs base error.\n #\n class Error < StandardError; end\n\nend\n" }, { "from": "gpt", "value": "module Acfs\n\n # Acfs base error.\n ...
ruby
chosen
[ { "from": "system", "value": "Drop test-coverage limit (of test) to 99%; on CI output varies\n" }, { "from": "human", "value": "\nMIN = {\n test_count:1,\n app_coverage:100,\n test_coverage:100,\n line_ratio:2.4,\n hits_ratio:1.0\n}\n\nMAX = {\n failures:0,\n errors:0,\n warnings:2,\n s...
ruby
chosen
[ { "from": "system", "value": "Fix spec failures and warnings in Rack::Lock under 1.9\n" }, { "from": "human", "value": "require 'test/spec'\n\nrequire 'rack/mock'\nrequire 'rack/lock'\n\ncontext \"Rack::Lock\" do\n class Lock\n attr_reader :synchronized\n\n def initialize\n @synchron...
ruby
chosen
[ { "from": "system", "value": "Add logic for ruby-debug gem version\n" }, { "from": "human", "value": "class Hash\n def flatten(joiner=\".\", &block)\n flat = combine_keys(self, joiner, [], &block).flatten\n Hash[*flat.map {|f| f.to_a}.flatten]\n end\n \nprivate\n def combine_keys(data,...
ruby
chosen
[ { "from": "system", "value": "Remove quiet flag in Capistrano bundler task\n\nTo enable a more verbose output that helps to follow on the deployment\nprocess and debug eventual problems.\n\ncivio/onodo#373\n" }, { "from": "human", "value": "namespace :bundler do\n desc \"Lock and cache the gems...
ruby
chosen
[ { "from": "system", "value": "Fix Marionette anchor links and improve readability\n\nFixes #235.\n" }, { "from": "human", "value": "module Docs\n class Marionette\n class CleanHtmlFilter < Filter\n def call\n root_page? ? root : other\n doc\n end\n\n def root\n ...
ruby
chosen
[ { "from": "system", "value": "Remove redundant method from AbstractResourceCollection\n" }, { "from": "human", "value": "require 'nacre/concerns/inflectible'\n\nmodule Nacre\n\n class AbstractResourceCollection < AbstractCollection\n\n include Enumerable\n extend Inflectible\n extend G...
ruby
chosen
[ { "from": "system", "value": "Add rake task for bsf locations migrator\n" }, { "from": "human", "value": "namespace :business_support_content do\n desc \"Imports Imminence facet data into the corresponding BusinessSupportEdition\"\n task :import_facet_data => :environment do\n BusinessSuppo...
ruby
chosen
[ { "from": "system", "value": "Include LICENSE and README files in release.\n" }, { "from": "human", "value": "$:.unshift File.expand_path(\"../lib\", __FILE__)\nrequire \"vagrant-darwin/version\"\n\nGem::Specification.new do |s|\n s.name = \"vagrant-darwin\"\n s.version = Vagran...
ruby
chosen
[ { "from": "system", "value": "Remove concurrent-ruby version from gemspec\n\nFor testing prerelease version\n" }, { "from": "human", "value": "GEM_NAME = 'pakyow-realtime'\n\nversion = File.read(\n File.join(\n File.expand_path('../../VERSION', __FILE__)\n )\n).strip\n\ngem_path = File.exis...
ruby
chosen
[ { "from": "system", "value": "Add Clang as an option to LLVM formula\n" }, { "from": "human", "value": "require 'formula'\n\nclass Llvm <Formula\n @url='http://llvm.org/releases/2.6/llvm-2.6.tar.gz'\n @homepage='http://llvm.org/'\n @md5='34a11e807add0f4555f691944e1a404a'\n\n def install\n ...
ruby
chosen
[ { "from": "system", "value": "Fix group to work on Rails 4\n" }, { "from": "human", "value": "=begin\nCopyright 2013 Andrey “A.I.” Sitnik <andrey@sitnik.ru>,\nsponsored by Evil Martians.\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU Lesser...
ruby
chosen
[ { "from": "system", "value": "Add `require` for backward compat\n" }, { "from": "human", "value": "module RSS\n module Atom\n class Feed\n include FeedHistory\n end\n end\nend\n" }, { "from": "gpt", "value": "require 'rss/atom/feed_history'\n\nmodule RSS\n module Atom\n...
ruby
chosen
[ { "from": "system", "value": "Sort hits by score when evalue is same.\n\nSigned-off-by: Alekhya Munagala <b2aa6119f2bf3cb55fa4719dcdf853cc5042ebcc@gmail.com>\n" }, { "from": "human", "value": "module SequenceServer\n # Define BLAST::Query.\n module BLAST\n # Capture results per query of a B...
ruby
chosen
[ { "from": "system", "value": "Add full_name to payment method\n" }, { "from": "human", "value": "module SpookyCore\n class PaymentMethod\n include XmlHelpers\n\n attr_reader :token, :details\n\n def self.find(token)\n response = Request.get(\"/payment_methods/#{token}.xml\")\n ...
ruby
chosen
[ { "from": "system", "value": "Add condition for empty networking" }, { "from": "human", "value": "require 'ipaddr'\nFacter.add(:network_zone) do\n setcode do\n # Exit with 'none' if there is no networking fact\n return 'none' unless !Facter.value(:networking)['interfaces'].nil?\n resul...
ruby
chosen
[ { "from": "system", "value": "Add new path for translations\n" }, { "from": "human", "value": "#encoding: UTF-8\nRSpec::Matchers.define :have_error do |erro|\n\n def error_message(record, atributo, erro)\n I18n.translate(\"errors.messages.#{erro}\")\n end\n\n chain :on do |atributo|\n @...
ruby
chosen
[ { "from": "human", "value": "Test for the High Voltage page action class, with our class extension.\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\ndescribe 'High Voltage Pages Action Class', type: :controller do\n controller(HighVoltage::PagesController) do\n def action_has_layou...
ruby
chosen
[ { "from": "system", "value": "Fix chef_gem compat for Chef 12.1.0\n" }, { "from": "human", "value": "#\n# Cookbook Name:: chef-vault\n# Recipe:: default\n#\n# Author: Joshua Timberman <joshua@getchef.com>\n#\n# Copyright (c) 2013, Opscode, Inc.\n#\n# Licensed under the Apache License, Version 2....
ruby
chosen
[ { "from": "system", "value": "Update the Podspec's version to 1.0.1\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'DateRangePicker'\n s.version = '1.0'\n\n s.homepage = 'https://github.com/MrMage/DateRangePicker'\n s.su...
ruby
chosen
[ { "from": "system", "value": "Update location of rubygems.org credentials\n\nNo longer using .gemrc, so tell them to update their .gem/credentials file instead!\r\n\r\nRef: #694\n" }, { "from": "human", "value": "class Api::V1::ApiKeysController < Api::BaseController\n before_filter :redirect_t...
ruby
chosen
[ { "from": "system", "value": "Destroy associated tasks when deleting a list\n" }, { "from": "human", "value": "class TaskList < ActiveRecord::Base\n belongs_to :owner, class_name: User\n has_many :tasks, -> { order :priority }, foreign_key: :list_id\n\n validates :owner, presence: true\n val...
ruby
chosen
[ { "from": "human", "value": "Bring the script for images.\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\n\nrequire 'fileutils'\nrequire 'pathname'\nrequire 'pp'\n\nunless ARGV.length == 2 then\n\tprint \"add_img <img_file> <post_file>\\n\"\n\texit\nend\n\nimg_fn = ARGV[0]\nimg_basename = ...
ruby
chosen
[ { "from": "human", "value": "Add ARM EABI binutils 2.20" }, { "from": "gpt", "value": "require 'formula'\n\nclass ArmEabiBinutils220 <Formula\n url 'http://ftp.gnu.org/gnu/binutils/binutils-2.20.1a.tar.bz2'\n homepage 'http://www.gnu.org/software/binutils/'\n sha1 '3f0e3746a15f806a95dd079be2a...
ruby
chosen
[ { "from": "system", "value": "Use the terminology \"patterns\" wrt to specing Spidr::Rules.\n" }, { "from": "human", "value": "require 'spidr/rules'\n\nrequire 'spec_helper'\n\ndescribe Rules do\n it \"should accept data based on acceptance data\" do\n rules = Rules.new(:accept => [1])\n\n ...
ruby
chosen
[ { "from": "system", "value": "Add cost method for CartItem model\n" }, { "from": "human", "value": "class CartItem < ActiveRecord::Base\n belongs_to :product\n belongs_to :user\n\n def weight\n product.weight * quantity\n end\nend\n" }, { "from": "gpt", "value": "class CartIte...
ruby
chosen
[ { "from": "system", "value": "Revert amount of loaded activities to 100\n" }, { "from": "human", "value": "class ActivitiesController < ApplicationController\n skip_before_filter :authenticate_user!\n before_filter :authenticate_silently\n\n def index\n filter = {}\n\n if params[:filter...
ruby
chosen
[ { "from": "system", "value": "Update SourceTree to version 1.9.2\n" }, { "from": "human", "value": "class Sourcetree < Cask\n url 'http://downloads.atlassian.com/software/sourcetree/SourceTree_1.9.1.dmg'\n homepage 'http://www.sourcetreeapp.com/'\n version '1.9.1'\n sha256 '0034097468b005ff0...
ruby
chosen
[ { "from": "system", "value": "Add uninstall stanza for SteerMouse\n" }, { "from": "human", "value": "class Steermouse < Cask\n url 'http://plentycom.jp/ctrl/files_sm/SteerMouse4.1.9.dmg'\n homepage 'http://plentycom.jp/en/steermouse/'\n version '4.1.9'\n sha256 '4704aa8b01842c2e619db546fa045...
ruby
chosen
[ { "from": "system", "value": "Fix SwitchResX with a version and sha256 to pass test\n" }, { "from": "human", "value": "class Switchresx < Cask\n url 'http://www.madrau.com/data/switchresx/SwitchResX4.zip'\n homepage 'http://www.madrau.com'\n version '4.x'\n sha256 :no_check\n prefpane 'Swit...
ruby
chosen
[ { "from": "system", "value": "Disable automatic screenshotting of failed tests as it slows down test runs during development\n" }, { "from": "human", "value": "require 'calabash-android/management/adb'\nrequire 'calabash-android/operations'\n\nBefore do |scenario|\n start_test_server_in_backgro...
ruby
chosen
[ { "from": "system", "value": "Prepare to release version 1.3\n" }, { "from": "human", "value": "Gem::Specification.new do |gem|\n gem.name = \"delayed_job_web\"\n gem.version = \"1.2.10\"\n gem.author = \"Erick Schmitt\"\n gem.email = \"ejschmitt@gmail.com\"\n gem.home...
ruby
chosen
[ { "from": "system", "value": "Reduce pipeline chain life span to minimize side effects\n" }, { "from": "human", "value": "module Gitlab\n module Ci\n module Pipeline\n module Chain\n class Sequence\n def initialize(pipeline, command, sequence)\n @pipeline = pi...
ruby
chosen
[ { "from": "system", "value": "Use full path with test unit files to support ruby 1.9.\n" }, { "from": "human", "value": "require File.expand_path(File.join(File.dirname(__FILE__), \"/helpers/ruby_env\"))\n\nclass TestUnitAdapter\n \n def self.command(project_path, ruby_interpreter, files)\n ...
ruby
chosen
[ { "from": "system", "value": "Fix cloud_files gemspec: nokogiri <1.10 for ruby <2.3\n" }, { "from": "human", "value": "require './gemspec_helper'\n\ngemspec_for 'cloud_files', [['net-ssh'], ['mime-types'], ['nokogiri'], ['fog-rackspace']]\n" }, { "from": "gpt", "value": "require './g...
ruby
chosen
[ { "from": "system", "value": "Switch to use global `$stdin`\n\nRather than the constant, this uses the global standard input variable\ninstead.\n" }, { "from": "human", "value": "module Brightbox\n command [:users] do |cmd|\n cmd.desc I18n.t(\"users.update.desc\")\n cmd.arg_name \"user-id...
ruby
chosen
[ { "from": "system", "value": "Create a `add_messages` to ResponseDSL\n" }, { "from": "human", "value": "module EndpointBase::Concerns\n module ResponseDSL\n extend ActiveSupport::Concern\n\n included do\n if EndpointBase.rails?\n include Helpers\n elsif EndpointBase.sinat...
ruby
chosen
[ { "from": "system", "value": "Split file args for RuboCop hook\n" }, { "from": "human", "value": "module Overcommit::Hook::PreCommit\n # Runs `rubocop` against any modified Ruby files.\n #\n # @see http://batsov.com/rubocop/\n class RuboCop < Base\n MESSAGE_TYPE_CATEGORIZER = lambda do |t...
ruby
chosen
[ { "from": "system", "value": "Fix cucumber configuration for integrity\n" }, { "from": "human", "value": "# Sets up the Rails environment for Cucumber\nENV[\"RAILS_ENV\"] = \"test\"\nrequire File.expand_path(File.dirname(__FILE__) + '/../../config/environment')\nrequire 'cucumber/rails/world'\nr...
ruby
chosen
[ { "from": "system", "value": "Remove sensitive data from feature recordings.\n" }, { "from": "human", "value": "require 'vcr'\n\nVCR.configure do |conf|\n conf.hook_into :webmock\n conf.cassette_library_dir = 'features/cassettes'\n conf.default_cassette_options = { :record => :new_episodes }\...
ruby
chosen
[ { "from": "system", "value": "Use UTC time in Authentication spec\n" }, { "from": "human", "value": "require 'spec_helper'\nrequire 'battlenet/authentication'\n\ndescribe Battlenet::Authentication do\n let(:auth) { Battlenet::Authentication.new 'private' }\n\n before(:each) do\n time = Time...
ruby
chosen
[ { "from": "system", "value": "Fix issue with AR merge\n" }, { "from": "human", "value": "class Story < ActiveRecord::Base\n extend FriendlyId\n friendly_id :name, use: :slugged\n\n belongs_to :project, touch: true\n belongs_to :owner, class_name: \"User\"\n has_many :tasks, -> { order(compl...
ruby
chosen
[ { "from": "system", "value": "Add unique validation to Thing\n\nFixes #3\n" }, { "from": "human", "value": "class Thing < ActiveRecord::Base\n has_many :check_outs, dependent: :destroy\n\n validates :quantity, numericality: { greater_than_or_equal_to: 0 }\n validates :name, presence: true\n\n...
ruby
chosen
[ { "from": "system", "value": "Set the rendered_contents in the source's metadata\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Dimples\n class Renderer\n def initialize(site, source)\n @site = site\n @source = source\n end\n\n def render(context =...
ruby
chosen
[ { "from": "system", "value": "Handle cases were no match categories have been specified.\n\nSince [].reduce( :& ) will return nil\n" }, { "from": "human", "value": "module Rubotium\n class Devices\n def initialize(options = {})\n @match_serial = options[:serial] || ''\n @match_nam...
ruby
chosen