conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Update class methods to use self\n" }, { "from": "human", "value": "class User < ApplicationRecord\n attr_accessor :remember_token\n before_save { email.downcase! }\n validates :name, presence: true, length: { maximum: 50 }\n VALID_EMAIL_REGEX = /\\A[\\w+\\-.]+@...
ruby
chosen
[ { "from": "system", "value": "Increase number of recently uploaded images\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n # Include default devise modules. Others available are:\n # :token_authenticatable, :confirmable,\n # :lockable, :timeoutable and :omniauthable\n dev...
ruby
chosen
[ { "from": "system", "value": "Use \"delete\" instead of \"gsub\"\n\nAccording to Rubocop this is faster.\n" }, { "from": "human", "value": "require 'chronic'\n\nclass PageReview\n attr_reader :page\n\n def initialize(page)\n @page = page\n end\n\n def reviewable?\n page.data.review_in....
ruby
chosen
[ { "from": "system", "value": "Revert to using the loadbalanced name\n" }, { "from": "human", "value": "#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# h...
ruby
chosen
[ { "from": "system", "value": "Add shortcut alias for 'server'\n\nSigned-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>\n" }, { "from": "human", "value": "require 'clamp'\nrequire 'creperie/commands'\nrequire 'creperie/loader'\n\nmodule Creperie\n class CLI < Commands...
ruby
chosen
[ { "from": "system", "value": "Remove default including of Helper::Ssh\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'rspec'\nrequire 'serverspec/version'\nrequire 'serverspec/matchers'\nrequire 'serverspec/backend'\nrequire 'serverspec/helper'\nrequire 'serverspec/setup'\nrequir...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to allow Rails 5.1\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"canvas_auth/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do |s|...
ruby
chosen
[ { "from": "human", "value": "Add specs for view helpers\n" }, { "from": "gpt", "value": "require 'spec_helper'\nrequire 'embeddable/view_helpers'\n\ndescribe Embeddable::ViewHelpers do\n subject { Dummy.new }\n\n class Dummy\n include Embeddable\n\n embeddable :video, from: :video_url\n ...
ruby
chosen
[ { "from": "system", "value": "Add test cases for Remote::StylesheetFile\n" }, { "from": "human", "value": "require 'pp' # Helps prevent an error like: 'superclass mismatch for class File'\nrequire 'bundler/setup'\nBundler.require(:default)\nrequire 'spec_helper'\nrequire './lib/everything/blog/s...
ruby
chosen
[ { "from": "system", "value": "Use gsub intead of tr when the to_str is longer than the from_str\n" }, { "from": "human", "value": "module ActionView\n # = Action View Debug Helper\n #\n # Provides a set of methods for making it easier to debug Rails objects.\n module Helpers\n module Debu...
ruby
chosen
[ { "from": "system", "value": "Use content_tag here instead of manually building HTML\n" }, { "from": "human", "value": "module ActionView\n # = Action View Debug Helper\n #\n # Provides a set of methods for making it easier to debug Rails objects.\n module Helpers\n module DebugHelper\n ...
ruby
chosen
[ { "from": "system", "value": "Exclude credits extension from generation\n\nIt was added for AMQP 1.0 plugin.\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n# encoding: utf-8\n\ndef sh(*args)\n system(*args)\nend\n\nextensions = [\"codegen/rabbitmq-codegen/credit_extension.json\"]\n\nsp...
ruby
chosen
[ { "from": "system", "value": "Allow list & record models to be specified via ENV variables\n" }, { "from": "human", "value": "namespace :netsuite do\n\n desc \"Sync all NetSuite records using import_all\"\n task :fresh_sync => :environment do\n NetSuiteRails::PollTimestamp.delete_all\n\n ...
ruby
chosen
[ { "from": "system", "value": "Remove index: true from migrations with too long index name\n\nMSP-12855\n\nIndexes are already created in `change_table` call.\n" }, { "from": "human", "value": "class CreateMcLicensableLicenses < ActiveRecord::Migration\n TABLE_NAME = \"mc_licensable_licenses\"\n...
ruby
chosen
[ { "from": "system", "value": "Update WP with note that it is unfinished\n" }, { "from": "human", "value": "#\n# DNA Shipistrano\n#\n# Wordpress - contains helpers for managing a generic deploy of wordpress\n#\n# Copyright (c) 2013, DNA Designed Communications Limited\n# All rights reserved.\n\ns...
ruby
chosen
[ { "from": "human", "value": "Add check for serialized attributes vulnerability\n\nCVE-2013-0277\n" }, { "from": "gpt", "value": "require 'brakeman/checks/base_check'\n\nclass Brakeman::CheckModelSerialize < Brakeman::BaseCheck\n Brakeman::Checks.add self\n\n @description = \"Report uses of ser...
ruby
chosen
[ { "from": "system", "value": "Fix image output file location.\n" }, { "from": "human", "value": "require 'cookbook_sdk/rake_tasks'\nrequire 'json'\n\nnamespace :jenkins do\n desc 'Generate attribute json file for image creation'\n task :pipeline_version do\n attributes_file = File.join('pro...
ruby
chosen
[ { "from": "system", "value": "Make the generator work with older versions of ActiveRecord\n" }, { "from": "human", "value": "class Create<%= plural_name.camelize %> < ActiveRecord::Migration\n def change\n create_table :<%= plural_name %> do |t|\n t.string :locked_by\n t.string :ke...
ruby
chosen
[ { "from": "system", "value": "Implement some methods for `Gentoo::Base::Package` follows:\n\n* `get_version`\n* `install`\n* `remove`\n" }, { "from": "human", "value": "class Specinfra::Command::Gentoo::Base::Package < Specinfra::Command::Linux::Base::Package\n class << self\n def check_is_i...
ruby
chosen
[ { "from": "system", "value": "Use readers in metadata spec\n" }, { "from": "human", "value": "require 'spec_helper'\nrequire 'fixtures/metadata_fixtures'\n\nmodule FFSplitter\n describe MetadataParser do\n describe \".parse\" do\n context \"with a single chapter\" do\n let(:metad...
ruby
chosen
[ { "from": "system", "value": "Add spec for localized short ordinal number\n\ne.g. 1st, 2nd in English and 1er, 2ème in French\n" }, { "from": "human", "value": "require \"ordinalize_full/integer\"\n\ndescribe OrdinalizeFull do\n describe \"#ordinalize_in_full\" do\n context \"with the defaul...
ruby
chosen
[ { "from": "system", "value": "Add area attribute to Api::Area factory\n" }, { "from": "human", "value": "FactoryBot.define do\n factory :api_area, class: Api::Area do\n area_code { 'nl' }\n analysis_year { 2015 }\n end\nend\n" }, { "from": "gpt", "value": "FactoryBot.define d...
ruby
chosen
[ { "from": "system", "value": "Add support for Rails 4\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"gatemedia-dnd/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do |s|\n s.na...
ruby
chosen
[ { "from": "system", "value": "Update cask formulae to use new header format\n" }, { "from": "human", "value": "class FontMenloPowerline < Cask\n url 'https://gist.github.com/raw/1627888/c4e92f81f7956d4ceaee11b5a7b4c445f786dd90/Menlo-ForPowerline.ttc.zip'\n homepage 'https://powerline.readthedo...
ruby
chosen
[ { "from": "system", "value": "Rename UoW job to async_job\n" }, { "from": "human", "value": "module AsyncClient\n module UnitOfWork\n def self.included(descendent)\n descendent.extend(ClassMethods)\n end\n\n module ClassMethods\n DEFAULT_QUEUE = \"default\".freeze\n\n de...
ruby
chosen
[ { "from": "system", "value": "Add homepage to gemspec and fix typo\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'pearl/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "system", "value": "Use yield instead of block.call\n" }, { "from": "human", "value": "require 'dry/events/publisher'\n\nmodule Dry\n module Monitor\n class Clock\n def measure(&block)\n start = current\n result = block.()\n stop = current\n [result...
ruby
chosen
[ { "from": "system", "value": "Add error message handling to comments\n" }, { "from": "human", "value": "class CommentsController < ApplicationController\n\n def new\n\n @answer = Answer.find(params[:answer_id])\n @comment = Comment.new(answer: @answer)\n\n end\n\n def create\n answer...
ruby
chosen
[ { "from": "system", "value": "Fix crash when posting invalid comments\n" }, { "from": "human", "value": "# frozen_string_literal: true\nclass CommentsController < ApplicationController\n before_action :authenticate_user!\n\n def create\n @ad = Ad.find params[:ad_id]\n @comment = @ad.comm...
ruby
chosen
[ { "from": "system", "value": "Fix project rename and webhook\n" }, { "from": "human", "value": "class ProjectsController < WebController\n before_action :get_projects\n\n MAX_REVISIONS = 15\n\n def index\n revision_count = 2\n locals revision_count: revision_count\n end\n\n def show\n...
ruby
chosen
[ { "from": "system", "value": "Add sessions to user authenticate method in sessions controller\n" }, { "from": "human", "value": "class SessionsController < ApplicationController\n\n def new\n\n end\n\n def create\n p params\n @user = User.find_by_username(params[:username])\n if @use...
ruby
chosen
[ { "from": "system", "value": "Fix for stupid mistake tobi pointed out.\n\n\ngit-svn-id: 70ab0960c3db1cbf656efd6df54a8f3de72dc710@142 820eb932-12ee-0310-9ca8-eeb645f39767\n" }, { "from": "human", "value": "class SettingsController < ApplicationController\n \n def install \n if config.is_ok?...
ruby
chosen
[ { "from": "system", "value": "Change the class name to TurnOutofIntoFloat\n" }, { "from": "human", "value": "class TurnOutOfIntoFloat < ActiveRecord::Migration\n def self.up\n remove_column :grade_entry_items, :out_of\n add_column :grade_entry_items, :out_of, :float\n end\n\n def self.d...
ruby
chosen
[ { "from": "human", "value": "Add fields to project for ownership/permissions\n\n\nFormer-commit-id: 8d8d27423e588fdcedd2a5eb0a905d9315e97f6a" }, { "from": "gpt", "value": "class AddFieldsToProject < ActiveRecord::Migration\n def self.up\n add_column :projects, :person_id, :integer\n add_c...
ruby
chosen
[ { "from": "system", "value": "Connect to broker based on yaml setting in transmit policy maintenance\n" }, { "from": "human", "value": "class TransmitPolicyMaintenance\n def execute(request)\n xml = CanonicalVocabulary::MaintenanceSerializer.new(\n Policy.find(request[:policy_id]),\n ...
ruby
chosen
[ { "from": "human", "value": "Add a simple feature spec to cover bulk publishing\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\nRSpec.feature 'Bulk publishing', type: :feature do\n include ContentItemHelper\n include PublishingApiHelper\n\n scenario 'A single taxon' do\n given_t...
ruby
chosen
[ { "from": "system", "value": "Fix drop down removing all spaces from the item list.\n" }, { "from": "human", "value": "module FieldableForm\n class DropDown < Field\n \n attr_accessible :required, :include_blank, :items\n \n # Overrides\n def render_method\n :select\n end...
ruby
chosen
[ { "from": "system", "value": "Add sha output for debugging.\n" }, { "from": "human", "value": "Spree::Shipment.class_eval do\n # puts DurableDecorator::Base.determine_sha('Spree::Shipment#after_ship')\n # TODO Using soft here since a strict is causing issues in one app but not another for some...
ruby
chosen
[ { "from": "system", "value": "Use Configuration without '::' from '::Configuration'\n" }, { "from": "human", "value": "class ContributionObserver < ActiveRecord::Observer\n observe :contribution\n\n def after_create(contribution)\n contribution.define_key\n generate_matches(contribution)...
ruby
chosen
[ { "from": "system", "value": "Fix Ruby 2.7 keyword arguments warning\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\n# On the fly delegation from the decorator to the decorated object and the helpers.\nmodule ActiveDecorator\n module Helpers\n def method_missing(method, *...
ruby
chosen
[ { "from": "system", "value": "Increase some timeout (see MSP).\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"sinatra queues test\" do\n\n deploy <<-END.gsub(/^ {4}/,'')\n application:\n root: #{File.dirname(__FILE__)}/../apps/sinatra/queues\n web:\n cont...
ruby
chosen
[ { "from": "human", "value": "Create podspec for version 1.1.0\n" }, { "from": "gpt", "value": "Pod::Spec.new do |s|\n s.name = \"BFWControls\"\n s.version = \"1.1.0\"\n s.summary = \"Common and interesting visual elements and controls.\"\n s.description = <<-DESC\n\t\tComm...
ruby
chosen
[ { "from": "system", "value": "Upgrade Light Table to v0.8.0\n" }, { "from": "human", "value": "cask :v1 => 'lighttable' do\n version '0.7.2'\n sha256 '236bb18d6715ce3095c975871b7c7f495f306a086dce8a50ff35f267a25c5163'\n\n # cloudfront.net is the official download host per the vendor homepage\n...
ruby
chosen
[ { "from": "system", "value": "Upgrade Pycharm CE.app to v2.4.1\n" }, { "from": "human", "value": "class PycharmCe < Cask\n url 'http://download.jetbrains.com/python/pycharm-community-3.4.dmg'\n homepage 'http://www.jetbrains.com/pycharm'\n version '3.4'\n sha256 'da083ac2761e4060e6b3c7446671...
ruby
chosen
[ { "from": "system", "value": "Use Time.now instead of Date.today for graphs.\n" }, { "from": "human", "value": "class GraphsController < ApplicationController\n \n # GET /graphs/running.xml\n def running\n @period = (Date.today - 30)..Date.today\n respond_to do |format|\n format.xm...
ruby
chosen
[ { "from": "system", "value": "Fix a json rendering error (the easy way)\n" }, { "from": "human", "value": "class SearchController < ApplicationController\n def index\n return if params[:q].blank?\n @query = params[:q].strip\n @result = {games: [Game.find_by(shortname: @query)]}\n if...
ruby
chosen
[ { "from": "system", "value": "Reset ImmediateExecutor to original state.\n" }, { "from": "human", "value": "require_relative 'executor'\n\nmodule Concurrent\n class ImmediateExecutor\n include Executor\n\n def post(*args, &task)\n raise ArgumentError.new('no block given') unless bloc...
ruby
chosen
[ { "from": "system", "value": "Use creature ID rather than species ID to track amount of unique pets owned (species ID can be the same between different pets).\n" }, { "from": "human", "value": "module Audit\n class CollectionData < Data\n def add\n @character.data['achievement_points'] ...
ruby
chosen
[ { "from": "system", "value": "Fix the respond_to? def on Company\n" }, { "from": "human", "value": "require 'arid_cache'\n\nclass User < ActiveRecord::Base\n has_many :companies, :foreign_key => :owner_id\n has_many :empty_user_relations # This must always return an empty list\n send(Rails.r...
ruby
chosen
[ { "from": "system", "value": "Fix privacy setting not being saved\n" }, { "from": "human", "value": "module Account\n class SettingsController < ApplicationController\n before_action :authenticate_user!\n before_action :set_settings\n\n def edit\n end\n\n def update\n respon...
ruby
chosen
[ { "from": "system", "value": "Remove empty styleguide controller action" }, { "from": "human", "value": "class StyleguideController < ApplicationController\n def show\n end\n\n def css\n @sections ||= Styleguide.new.sections.inject({}) do |h, (k, v)|\n h[k] = StyleguideSectionDecorato...
ruby
chosen
[ { "from": "system", "value": "Fix user added to group notification\n" }, { "from": "human", "value": "class Events::UserAddedToGroup < Event\n include Events::EmailUser\n include Events::NotifyUser\n\n def self.publish!(membership, inviter, message = nil)\n bulk_publish!(Array(membership),...
ruby
chosen
[ { "from": "human", "value": "Check list palindrome recursively hnnnnhnhnnnnnggggggh (><)\n" }, { "from": "gpt", "value": "class List < Struct.new(:val, :link)\nend\n\ndef palindrome?(list, back)\n return true if list.nil?\n result = palindrome?(list.link, back)\n node = back[0]\n bac...
ruby
chosen
[ { "from": "system", "value": "Add rdoc generation to gem and bump version slightly\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = \"rb232\"\n s.version = \"0.2.0\"\n s.date = \"2008-08-19\"\n s.summary = \"A simple serial port library for Ruby\"\n s.email = \"ja...
ruby
chosen
[ { "from": "system", "value": "Revert \"Use recently introduced CreateBuildService.\"\n\nThis reverts commit 7d2a4f3f867e5c323a4bbddfc3b9c209b4ad9cba.\n" }, { "from": "human", "value": "module Citrus\n module Web\n class GithubPushResource < Resource\n\n def allowed_methods\n %w(P...
ruby
chosen
[ { "from": "system", "value": "Package version increased from 0.3.0.0 to 0.3.0.1\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'log'\n s.version = '0.3.0.0'\n s.summary = 'Logging to STD IO with levels, tagging, and coloring'\n s.descri...
ruby
chosen
[ { "from": "system", "value": "Return key is now \"Go\"\n" }, { "from": "human", "value": "class AppDelegate\n def application(application, didFinishLaunchingWithOptions:launchOptions)\n\n @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)\n\n # Prepare form\n @form = Fo...
ruby
chosen
[ { "from": "system", "value": "Check for numeric class instead of integer.\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule Pennies\n\n module Mongo\n\n module MoneyExtensions\n\n def self.included(base)\n base.extend ClassMethods\n end\n\n module ClassMeth...
ruby
chosen
[ { "from": "system", "value": "Support paging for IAM user call\n\nThis is just an initial PoC to show how to use the Ruby AWS SDK's paging\nsupport. Would have to look into a better solution for the entire list\nof resources.\n" }, { "from": "human", "value": "module Terraforming\n module Resou...
ruby
chosen
[ { "from": "system", "value": "Add ctags_exuberant recipe to sprout-wrap" }, { "from": "human", "value": "include_recipe \"pivotal_workstation::bash_it\"\ninclude_recipe \"pivotal_workstation::ccmenu\"\ninclude_recipe \"pivotal_workstation::git_config_global_defaults\"\ninclude_recipe \"pivotal_w...
ruby
chosen
[ { "from": "system", "value": "Update base controller to check for outdated browser.\n" }, { "from": "human", "value": "class BaseController < InheritedResources::Base\n before_filter :authenticate_user!\n # inherit_resources\nend\n" }, { "from": "gpt", "value": "class BaseControlle...
ruby
chosen
[ { "from": "system", "value": "Stop using respond_to feature removed from Rails\n\nIt's not useful in any case, as the same can be achieved by rendering\nJSON explicitly.\n" }, { "from": "human", "value": "class PingController < ApplicationController\n respond_to :json\n\n def index\n to_re...
ruby
chosen
[ { "from": "system", "value": "Add metric submission support for all kinds of metrics (missing enumerize)\n" }, { "from": "human", "value": "require 'fileutils'\n\nclass BenchmarkDefinition < ActiveRecord::Base\n before_destroy :remove_vagrant_directory\n\n has_many :metric_definitions\n has_m...
ruby
chosen
[ { "from": "system", "value": "Fix demo controller connexion spec Gestionnaire\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Gestionnaires::SessionsController, type: :controller do\n before do\n @request.env[\"devise.mapping\"] = Devise.mappings[:gestionnaire]\n end\n\...
ruby
chosen
[ { "from": "human", "value": "Add basic tests for persister errors\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe Encore::Persister do\n let(:persister) { Encore::Persister::Instance.new(model, params) }\n let(:persist!) { persister.persist! }\n\n let(:run_migrations!) do\n...
ruby
chosen
[ { "from": "system", "value": "Fix descriptions for job spec\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe BackfillSignatureUuidsJob, type: :job do\n context \"when the uuid column is nil\" do\n let(:signature) { FactoryBot.create(:signature, email: \"alice@examp...
ruby
chosen
[ { "from": "system", "value": "Update user serializer to show email and provider\n" }, { "from": "human", "value": "class UserSerializer < ActiveModel::Serializer\n attributes :id, :username\n has_many :collections\n has_many :comments\nend\n" }, { "from": "gpt", "value": "class Us...
ruby
chosen
[ { "from": "human", "value": "Create rake task for clearing out old pageviews\n" }, { "from": "gpt", "value": "namespace :looks do\n desc \"clear out old pageviews\"\n task :gc do\n require 'bundler'\n Bundler.require\n require 'exercism'\n\n sql = \"DELETE FROM looks WHERE updated_...
ruby
chosen
[ { "from": "system", "value": "Add functions to Twilio controller\n\nAdd more specific call function to send texts. Refractor code to one function from two.\nAdd twillio account information and new variables for calling on user phone number and plant ids.\n" }, { "from": "human", "value": "class ...
ruby
chosen
[ { "from": "human", "value": "Add a plugin to count how many lines a user sends in a channel\n" }, { "from": "gpt", "value": "class LineCount\n attr_accessor :users\n \n def initialize(sender, s)\n @users = s['users'] if s.has_key?('users')\n @users = Hash.new if not @users\n end\n \n ...
ruby
chosen
[ { "from": "system", "value": "Remove ngui, since it isn't released, yet\n" }, { "from": "human", "value": "#\n# Cookbook Name:: coopr\n# Recipe:: fullstack\n#\n# Copyright © 2013-2014 Cask Data, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this ...
ruby
chosen
[ { "from": "system", "value": "Fix name and license info" }, { "from": "human", "value": "name 'syslog_handler'\nmaintainer 'MITRE'\nmaintainer_email 'jblaine@mitre.org'\nlicense 'All rights reserved'\ndescription 'Installs/Configures syslog_handler'\nlong_descript...
ruby
chosen
[ { "from": "system", "value": "Add supported platforms to the readme\n\nThese are the roughly tested platforms\\\n\nSigned-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>\n" }, { "from": "human", "value": "name 'swap'\nmaintainer 'Seth Vargo'\nmaintainer_email 'sethvargo@gmai...
ruby
chosen
[ { "from": "system", "value": "Update podspec to make `pod trunk push` work as expected\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'WebViewJavascriptBridge'\n s.version = '4.1.3'\n s.summary = 'An iOS/OSX bridge for sending messages between Obj-C and J...
ruby
chosen
[ { "from": "system", "value": "Fix Topic relation with entities\n" }, { "from": "human", "value": "class Topic < ActiveRecord::Base\n has_one :entity\n\n\tvalidates :title, presence: true, uniqueness: true\n\n\tacts_as_url :title, url_attribute: :slug, only_when_blank: true\n\tdef to_param\n\t ...
ruby
chosen
[ { "from": "human", "value": "Add benchmark for inline caches\n" }, { "from": "gpt", "value": "require 'benchmark'\nrequire 'benchmark/ips'\n\nclass Class0; def called_method; end; end\nclass Class1; def called_method; end; end\nclass Class2; def called_method; end; end\nclass Class3; def called_...
ruby
chosen
[ { "from": "system", "value": "Update rake requirement from ~> 12.0 to ~> 13.0\n\nUpdates the requirements on [rake](https://github.com/ruby/rake) to permit the latest version.\n- [Release notes](https://github.com/ruby/rake/releases)\n- [Changelog](https://github.com/ruby/rake/blob/master/History.rdoc)\n- [...
ruby
chosen
[ { "from": "system", "value": "Remove hashable_object require from UserCollection\n" }, { "from": "human", "value": "require 'intercom/user_resource'\nrequire 'intercom/flat_store'\nrequire 'intercom/social_profile'\nrequire 'intercom/hashable_object'\n\nmodule Intercom\n # A collection of your ...
ruby
chosen
[ { "from": "system", "value": "Send the same data to rummager as content-store\n\nThis makes sure that the rendering_app, publishing_app and\ncontent_store_document_type are the same in rummager and content store.\nCurrently we're sending \"publisher\" as rendering app wrongly. We're\nalso sending the \"kind...
ruby
chosen
[ { "from": "system", "value": "Add foreman export / restart\n" }, { "from": "human", "value": "# config valid only for Capistrano 3.1\nlock \"3.2.1\"\n\nset :application, \"TODO: application name goes here\"\nset :repo_url, \"TODO: repo url goes here\"\nset :branch, \"master\"\nset ...
ruby
chosen
[ { "from": "system", "value": "Add line to describe middleware\n" }, { "from": "human", "value": "module Rack\n class SubdomainCookies\n DOMAIN_REGEXP = /([^.]*)\\.([^.]*|..\\...|...\\...)$/\n LOCALHOST_OR_IP_REGEXP = /^([\\d.]+(:\\d+)?|localhost)$/\n\n def initialize(app)\n @app =...
ruby
chosen
[ { "from": "system", "value": "Fix a few rubocop offenses\n" }, { "from": "human", "value": "class Build\n class Config\n class Dist\n DIST_LANGUAGE_MAP = {\n 'objective-c' => 'osx',\n }\n DIST_OS_MAP = {\n 'osx' => 'osx'\n }\n DEFAULT_DIST = 'precise'\n...
ruby
chosen
[ { "from": "system", "value": "Add default URL for Devise\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 reloaded on\n # ever...
ruby
chosen
[ { "from": "system", "value": "Set options for Sass (compact, no comments)\n" }, { "from": "human", "value": "# Settings specified here will take precedence over those in config/environment.rb\n\n# In the development environment your application's code is reloaded on\n# every request. This slows...
ruby
chosen
[ { "from": "system", "value": "Use __dir__ instead of File.dirname(__FILE__)\n" }, { "from": "human", "value": "require \"thor\"\n\nmodule DaimonSkycrawlers\n module Generator\n class New < Thor::Group\n include Thor::Actions\n\n argument :name\n\n def self.source_root\n ...
ruby
chosen
[ { "from": "system", "value": "Add sorting by emails on the signin page.\n" }, { "from": "human", "value": "require_dependency \"current_user/application_controller\"\n\nmodule CurrentUser\n class SessionsController < ApplicationController\n before_filter :check_key\n\n def new\n @use...
ruby
chosen
[ { "from": "system", "value": "Check for nil before cast to symbol in action mailer config\n" }, { "from": "human", "value": "ActionMailer::Base.default_url_options[:host] = ENV['MAILER_DEFAULT_URL_OPTIONS_HOST'] || 'localhost:3000'\nActionMailer::Base.smtp_settings = {\n address: ENV['MAILER_AD...
ruby
chosen
[ { "from": "system", "value": "Add missing methods to ArticleDrop\n" }, { "from": "human", "value": "module Edicy::Liquid::Drops\n class ArticleDrop < Liquid::Drop\n \n def initialize(article)\n @article = article\n end\n\n end\nend\n" }, { "from": "gpt", "value": "modul...
ruby
chosen
[ { "from": "human", "value": "Add test for model updating\n" }, { "from": "gpt", "value": "require 'test_helper'\n\nclass RailsOps::Operation::Model::UpdateTest < ActiveSupport::TestCase\n include TestHelper\n\n BASIC_OP = Class.new(RailsOps::Operation::Model::Update) do\n model Group\n end...
ruby
chosen
[ { "from": "system", "value": "Reduce articles per batch for average views import\n\nSince this happens in parallel now for multiple courses, we need to lower the concurrency versus when we used ViewsUpdate.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nclass AverageViewsImp...
ruby
chosen
[ { "from": "system", "value": "Add first 20 seeds, base loc SOMA\n" }, { "from": "human", "value": "class RestaurantsController < ApplicationController\n\tdef index\n\t\tparameters = { term: params[:search], limit:10}\n\t\tparams[:location].length > 0 ? @location_filter = params[:location] : @loc...
ruby
chosen
[ { "from": "system", "value": "Update elasticsearch synchronisation rake task with a decent logger\n" }, { "from": "human", "value": "module TasksProcessor\n def log(str)\n puts(\"#{timestamp} #{str}\")\n end\n\n def timestamp\n Time.now.strftime('[%d/%m/%Y %T]')\n end\nend\n\nnamespace...
ruby
chosen
[ { "from": "system", "value": "Change the class variable name\n" }, { "from": "human", "value": "require 'json'\n\nmodule TrySailBlogNotification\n class Dumper\n\n attr_reader :file\n attr_reader :data\n attr_reader :json_data\n\n def initialize(file)\n @file = file\n end\n\...
ruby
chosen
[ { "from": "system", "value": "Disable event file watcher in dummy Rails app.\n\nReason:\n\n bundler: failed to load command: mutant (/Users/pawelpacana/.rbenv/versions/2.5.0/bin/mutant)\n LoadError: Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile\n\nWe've dis...
ruby
chosen
[ { "from": "system", "value": "Change name of draw route\n" }, { "from": "human", "value": "Rails.application.routes.draw do\n # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html\n\n\troot 'welcome#index'\n\n\tget '/letters' => 'letters#index'\n\n\...
ruby
chosen
[ { "from": "system", "value": "Use ActiveSupport::ParameterFilter instead of ActionDispatch::Http::ParameterFilter in Rails 6 and above\n" }, { "from": "human", "value": "class Grape::Middleware::Logger::Railtie < Rails::Railtie\n options = Rails::VERSION::MAJOR < 5 ? { after: :load_config_initi...
ruby
chosen
[ { "from": "human", "value": "Add request spec for backend authentication.\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\ndescribe 'authentication' do\n let(:admin) { create(:admin, email: 'foo@bar.baz', password: 'foo', password_confirmation: 'foo') }\n\n describe 'redirects to log...
ruby
chosen
[ { "from": "system", "value": "Set enum constant for original access\n" }, { "from": "human", "value": "module Mongoid\n module EnumMapper\n extend ActiveSupport::Concern\n\n def self.included(base)\n base.extend(ClassMethods)\n end\n\n module ClassMethods\n def define_enum...
ruby
chosen
[ { "from": "system", "value": "Add apiconnect to npm packages\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\nputs \"Running Node version: #{`node --version`}\"\nnpms = {\n # module name => module command\n # leave command blank if they are the same\n \"azure-cli\" => \"azure\",\n \...
ruby
chosen
[ { "from": "system", "value": "Use thread local for storing connection pool\n" }, { "from": "human", "value": "require \"monitor\"\n\nmodule SSHKit\n\n module Backend\n\n class ConnectionPool\n\n attr_accessor :idle_timeout\n\n def initialize\n self.idle_timeout = 30\n ...
ruby
chosen