conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use page 0 image for master image\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nclass ImageUploaderBase < Shrine\n ALLOWED_TYPES = %w(image/gif image/jpeg image/png).freeze\n MAX_SIZE = 10.megabytes\n MAX_SIDE_LENGTH = 5000\n\n plugin :remo...
ruby
chosen
[ { "from": "system", "value": "Use 'expect' instead of 'should'\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe Article, type: :model do\n describe \".published\" do\n \tbefore do\n \t FactoryGirl.create_list :published_article, 2\n \t FactoryGirl.create_list :un...
ruby
chosen
[ { "from": "system", "value": "Fix text positioning to work better with IM 6.3.1\n" }, { "from": "human", "value": "require 'rvg/rvg'\n\nMagick::RVG.dpi = 90\n\nrvg = Magick::RVG.new(10.cm, 3.cm).viewbox(0,0,1000,300) do |canvas|\n canvas.background_fill = 'white'\n\n canvas.g.translate(100...
ruby
chosen
[ { "from": "system", "value": "Refactor spec to remove AS 3.1 deprecation warning\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"MongoDoc::Root\" do\n class RootTest\n include MongoDoc::Root\n attr_accessor_with_default(:_associations) {[]}\n attr_accessor :assoc...
ruby
chosen
[ { "from": "system", "value": "Add helper method to spec\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe RubyTokenizer do\n it 'has a version number' do\n expect(RubyTokenizer::VERSION).not_to be nil\n end\n\n it 'does something useful' do\n expect(false).to eq(true)...
ruby
chosen
[ { "from": "system", "value": "Remove redundant changes to slimmer use\n" }, { "from": "human", "value": "Frontend::Application.configure do\n # Settings specified here will take precedence over those in config/application.rb\n\n # The test environment is used exclusively to run your applicatio...
ruby
chosen
[ { "from": "system", "value": "Fix bug introduced in Rubocop refactoring\n" }, { "from": "human", "value": "module EventsHelper\n def event_location(event)\n location = Location.find(event.location_id)\n html = ''\n content_tag(:address) do\n html <<\n \"#{location.address1}...
ruby
chosen
[ { "from": "system", "value": "Remove unused DYNO variable\nThis variable was provided by heroku when the project first started.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'statsd'\n\nclass Stats\n def initialize\n @statsd = Statsd.new('127.0.0.1', 8125)\n en...
ruby
chosen
[ { "from": "system", "value": "Make parent_id and child_id assignable\n" }, { "from": "human", "value": "class TaxonAncestor < ActiveRecord::Base\n # attr_accessible :title, :body\n belongs_to :parent, :class_name => \"Taxon\"\n belongs_to :child, :class_name => \"Taxon\"\n \nend\n" }, ...
ruby
chosen
[ { "from": "system", "value": "Add missing ruby files to gemspec\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'nack'\n s.version = '0.0.0'\n s.date = '2010-09-19'\n s.summary = 'Node Rack server'\n s.description = <<-EOS\n Node powered Rack server\...
ruby
chosen
[ { "from": "system", "value": "Fix a typo in AbsenceValidator\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule ActiveModel\n module Validations\n # == \\Active \\Model Absence Validator\n class AbsenceValidator < EachValidator #:nodoc:\n def validate_each(rec...
ruby
chosen
[ { "from": "system", "value": "Add line level subsidiary field\n" }, { "from": "human", "value": "module NetSuite\n module Records\n class InterCompanyJournalEntryLine\n include Support::Fields\n include Support::RecordRefs\n include Support::Records\n include Namespaces::...
ruby
chosen
[ { "from": "human", "value": "Add day 25: Assembunny Clock\n" }, { "from": "gpt", "value": "require_relative 'lib/assembunny'\nassembler = Assembunny::Interpreter.new(ARGF.readlines)\n\n# We can't be sure that any number of bits is enough for *arbitrary* input,\n# But for *my* input, the program ...
ruby
chosen
[ { "from": "system", "value": "Update Jekyll to version 3.9.0\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nGem::Specification.new do |spec|\n spec.name = \"no-style-please\"\n spec.version = \"0.4.4\"\n spec.authors = [\"Riccardo Graziosi\"]\n spec....
ruby
chosen
[ { "from": "system", "value": "[tests] Add more generic evaluation alias.\n" }, { "from": "human", "value": "lib_path = File.expand_path(\"../../lib\")\n$LOAD_PATH.unshift lib_path\n\nrequire 'dill/cucumber'\n\nmodule Widget\n def self.defined_widgets\n @defined_widgets ||= []\n end\n\n def...
ruby
chosen
[ { "from": "system", "value": "Hide authentication error messages during tests\n" }, { "from": "human", "value": "require Rails.root.join('lib', 'yammer-strategy')\nrequire Rails.root.join('lib', 'yammer-staging-strategy')\nOmniAuth.config.on_failure = SessionsController.action(:oauth_failure)\n\...
ruby
chosen
[ { "from": "system", "value": "Convert realm to downcase when building email\n" }, { "from": "human", "value": "require \"omniauth\"\nrequire \"krb5_auth\"\nrequire \"omniauth/multipassword/base\"\n\nmodule OmniAuth\n module Strategies\n class Kerberos\n include OmniAuth::Strategy\n ...
ruby
chosen
[ { "from": "system", "value": "Add todo note about pending refactor in tests\n" }, { "from": "human", "value": "require 'dry/types'\nrequire 'rom/support/inflector'\n\nmodule SchemaHelpers\n def define_schema(source, attrs)\n ROM::Schema.define(\n source,\n attributes: attrs.map do ...
ruby
chosen
[ { "from": "human", "value": "Add a function to return a value as an inline yaml string\n" }, { "from": "gpt", "value": "require 'yaml'\n\nPuppet::Functions.create_function(:inline_yaml) do\n dispatch :from_variable do\n param 'Hash', :variable\n optional_param 'Hash', :parameters\n ret...
ruby
chosen
[ { "from": "system", "value": "Use MEJS4 unless told to do otherwise\n" }, { "from": "human", "value": "# Copyright 2011-2017, The Trustees of Indiana University and Northwestern\n# University. Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file exc...
ruby
chosen
[ { "from": "human", "value": "Fix verify pipeline oc-id tests\n\noc-id is built on rails 4.2.11 which fails tests with:\n\n`ThreadError: already initialized` with Ruby 2.6.x\n\nThis commit adds src/oc-id/spec/support/monkeypatch.rb to prevent rails\nfrom reusing `ActionController::TestResponse` object in tes...
ruby
chosen
[ { "from": "system", "value": "Remove association that's already added by Spree's calculated_adjustments\n" }, { "from": "human", "value": "class EnterpriseFee < ActiveRecord::Base\n belongs_to :enterprise\n\n calculated_adjustments\n has_one :calculator, :as => :calculable, :dependent => :d...
ruby
chosen
[ { "from": "system", "value": "Add unimplemented functions to Device\n" }, { "from": "human", "value": "# Methods for getting and setting device details\n\nrequire 'json'\n\nmodule AppleDEPClient\n module Device\n FETCH_URL = 'https://mdmenrollment.apple.com/server/devices'\n FETCH_LIMIT =...
ruby
chosen
[ { "from": "system", "value": "Check for mingw32 and it's all good on windows\n" }, { "from": "human", "value": "# coding: utf-8\n\nmodule Boom\n # Color collects some methods for colorizing terminal output.\n module Color\n extend self\n\n CODES = {\n :reset => \"\\e[0m\",\n ...
ruby
chosen
[ { "from": "system", "value": "Fix issue with callbacks clonning\n" }, { "from": "human", "value": "module AggregateBuilder\n module Metadata\n class CallbacksCollection\n def initialize\n @callbacks = {}\n end\n\n def clone\n clonned = self.class.new\n clo...
ruby
chosen
[ { "from": "system", "value": "Refactor block using one liner\n" }, { "from": "human", "value": "require \"gem_search/rendering\"\nmodule GemSearch\n module Commands\n class Run < Base\n include Mem\n include Rendering\n\n ENABLE_SORT_OPTS = {\n \"a\" => \"downloads\",\n...
ruby
chosen
[ { "from": "system", "value": "Bump version for next release\n\nChange-Id: Iea68442b3694e7a0daddbffb9d107d2179d20ff9\nReviewed-on: http://review.engineyard.com/145\nReviewed-by: Andy Delcambre <dceae9ae498de7d794de551710d5e4d9b952cadb@engineyard.com>\nTested-by: Andy Delcambre <dceae9ae498de7d794de551710d5e4...
ruby
chosen
[ { "from": "system", "value": "Set config file path in ERB so __FILE__ can be used\n" }, { "from": "human", "value": "require \"erb\"\n\nmodule MailRoom\n # Wraps configuration for a set of individual mailboxes with global config\n # @author Tony Pitale\n class Configuration\n attr_accessor...
ruby
chosen
[ { "from": "system", "value": "Add support for Rails API-mode\n" }, { "from": "human", "value": "# frozen_string_literal: true\nmodule Jb\n class Railtie < ::Rails::Railtie\n initializer 'jb' do\n ActiveSupport.on_load :action_view do\n require 'jb/action_view_monkeys'\n re...
ruby
chosen
[ { "from": "system", "value": "Include into AC::Base instead of ApplicationController\n" }, { "from": "human", "value": "require 'pjax'\n\nmodule PjaxRails\n class Engine < ::Rails::Engine\n initializer \"pjax_rails.add_controller\" do\n config.to_prepare { ApplicationController.send :in...
ruby
chosen
[ { "from": "system", "value": "Add alternative AntConc version for snow leopard or lower\n" }, { "from": "human", "value": "cask :v1 => 'antconc' do\n version '3.4.3'\n sha256 'c63b9a9fd60a97c8551c6fa2902663568be9cdabee5601a2fe99715f47921421'\n\n url \"http://www.laurenceanthony.net/software/a...
ruby
chosen
[ { "from": "human", "value": "Add ASIX AX88772 Driver v2.1.0_20140428\n\nRunning \"strings\" on the binary uninstaller reveals several strings\nwhich appear to be shell calls to \"kextunload\" and \"pkgutil --forget\"\nso, running the uninstaller should be sufficient to remove the driver,\nunload it and remo...
ruby
chosen
[ { "from": "system", "value": "Add link field to CodeKit Class\n" }, { "from": "human", "value": "class Codekit < Cask\n url 'http://incident57.com/codekit/files/codekit-8300.zip'\n homepage 'http://incident57.com/codekit/'\n version '1.6.2 (8300)'\n sha1 '842ba4f5d6ecf596abee1f80e3672b9771e2...
ruby
chosen
[ { "from": "system", "value": "Test shortcut for gitlab integration\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Magnum::Payload do\n describe '.parse' do\n it 'returns payload instance for github' do\n payload = Magnum::Payload.parse('github', fixture('github.jso...
ruby
chosen
[ { "from": "system", "value": "Add a workaround for exceptional DataObjects::SqlServer naming\n\n* See also DO commit ee3a6fe.\n* Most likely completely unnecessary, but the conversion of the\n snake_cased to CamelCased name, doesn't give us the chance to\n follow the DB Vendor's naming convention (so yes,...
ruby
chosen
[ { "from": "system", "value": "Update Climb.phar to version 0.7.0\n\nCloses #2553.\n\nSigned-off-by: Andy Blyler <e3579b1e47f273529f0f929453e939a68ede9fd1@blyler.cc>\n" }, { "from": "human", "value": "require File.expand_path(\"../../Abstract/abstract-php-phar\", __FILE__)\n\nclass Climb < Abstra...
ruby
chosen
[ { "from": "system", "value": "Revert \"remove matezoide from using command\"\n\nThis reverts commit 18044d44faaffd16aa7d45b67184387433eba616.\n" }, { "from": "human", "value": "require 'cinch'\n\nclass YololPlugin\n include Cinch::Plugin\n \n match /^!yolol/i\n\n def execute(m)\n m.reply(...
ruby
chosen
[ { "from": "system", "value": "Fix visible_taxons to return all taxons\n\nInstead of just the level one taxons. This fixes it's use in\nTaxonomyTagForm, where it's used to remove taxons from the list of\ninvisible taxons.\n\nWithout this change, you can't untag content from level 2 or below\ntaxons, because ...
ruby
chosen
[ { "from": "system", "value": "Change from regex to hash with counts\n" }, { "from": "human", "value": "class Hand\n def initialize(dice = [])\n @dice = dice\n end\n\n def face_values\n @dice.map {|e| e.face_value }\n end\n\n def rank\n faces = face_values.join\n\n case faces\n ...
ruby
chosen
[ { "from": "system", "value": "Fix Rubocop lints in gemspec\n\nPrefer $LOAD_PATH over $: as it is more descriptive.\n\nChange-Id: I5b6ce760fd5d0d8be5e9039007155fe1e04c9ed1\nReviewed-on: http://gerrit.causes.com/36170\nTested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>\nReviewed-by: Shan...
ruby
chosen
[ { "from": "system", "value": "Print test directory on failure\n\nSigned-off-by: Maria Shaldibina <dc03896a0185453e5852a5e0f0fab6cbd2e026ff@pivotal.io>\n" }, { "from": "human", "value": "require 'tmpdir'\nrequire 'tempfile'\nrequire 'fileutils'\nrequire 'bosh/dev/sandbox/debug_logs'\n\nRSpec.conf...
ruby
chosen
[ { "from": "system", "value": "Fix install failures on debian platforms\n\nSigned-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>\n" }, { "from": "human", "value": "#\n# Cookbook Name:: sqitch\n# Recipe:: default\n#\n# Copyright 2013-2016, Chef Software, Inc.\n#\n\ninclude_re...
ruby
chosen
[ { "from": "system", "value": "Make API return valid status codes\n" }, { "from": "human", "value": "module ApiDefaults\n extend ActiveSupport::Concern\n\n # Default Paths\n API_VIEW_PATH = \"api/v1\"\n API_DEFAULT_SUCCESS_PATH = \"defaults/success\"\n API_DEFAULT_FAIL_PATH = \"defaults/fail\"\n\...
ruby
chosen
[ { "from": "system", "value": "Create separate method where a csv is created with colocated buildings with charter\n" }, { "from": "human", "value": "def create_colocated_schools_ary(schools_hsh)\n\tcolocated_addresses_w_charter = []\n\tcharters_colocation = open_csv(\"csv/colocated-charters-and-...
ruby
chosen
[ { "from": "system", "value": "Change .com to .org in the do-not-reply address\n" }, { "from": "human", "value": "DO_NOT_REPLY = \"do-not-reply@awesomefoundation.com\"\n\nActionMailer::Base.smtp_settings = {\n :address => \"smtp.sendgrid.net\",\n :port => \"25\",\n :authentica...
ruby
chosen
[ { "from": "system", "value": "Make sure this can be autoloaded.\n" }, { "from": "human", "value": "require 'uri'\n\nmodule Pod\n class Downloader\n autoload :Git, 'cocoapods/downloader/git'\n autoload :Mercurial, 'cocoapods/downloader/mercurial'\n autoload :Subversion, 'cocoapo...
ruby
chosen
[ { "from": "system", "value": "Use a shared variable for all connections\n" }, { "from": "human", "value": "module ElasticRecord\n module Model\n def self.included(base)\n base.class_eval do\n extend Searching\n extend ClassMethods\n extend FromSearchHit\n inc...
ruby
chosen
[ { "from": "system", "value": "Use the application's assets.debug config\n" }, { "from": "human", "value": "require 'jasmine-core'\n\nmodule JasmineRails\n class Engine < Rails::Engine\n isolate_namespace JasmineRails\n\n initializer :assets do |config|\n Rails.application.config.asse...
ruby
chosen
[ { "from": "system", "value": "Add options to pass in the organization to the commandline\n" }, { "from": "human", "value": "require 'rails/generators'\nrequire 'rails/generators/rails/app/app_generator'\n\nmodule Maguro\n class AppGenerator < Rails::Generators::AppGenerator\n\n # Overriding ...
ruby
chosen
[ { "from": "system", "value": "Add jobs as Client extension" }, { "from": "human", "value": "require File.expand_path('../client/endpoints.rb', __FILE__)\n\nmodule MakePrintable\n class Client\n attr_accessor :api_key, :api_secret\n\n def initialize\n @api_key, @api_secret = [MakePrin...
ruby
chosen
[ { "from": "system", "value": "Add rake task to migrate apps to new domain.\n\nAs part of our migration to Carrenza we are taking\nthe opportunity to sort out some of our domains,\nnamely kill alphagov. We need to have a way to\nupdate all signon apps redirect_uri and home_ui.\n" }, { "from": "human"...
ruby
chosen
[ { "from": "system", "value": "Check file exist in generate erd.\n" }, { "from": "human", "value": "desc 'Generate Entity Relationship Diagram'\ntask :generate_erd do\n system 'bundle exec erd --inheritance --filetype=dot --notation=bachman --direct --attributes=foreign_keys,content'\n system '...
ruby
chosen
[ { "from": "system", "value": "Copy check_entities rake task from TC\n" }, { "from": "human", "value": "namespace :i18n do\n namespace :hygiene do\n\n desc \"Check there are no values containing return symbols\"\n task check_return_symbols: :environment do\n puts \"Checking that no va...
ruby
chosen
[ { "from": "system", "value": "Add support for new chef provisioners on Vagrant 1.7\n" }, { "from": "human", "value": "module VagrantPlugins\n module Ohai\n module Helpers\n\n def chef_provisioners\n @machine.config.vm.provisioners.find_all {|provisioner|\n [:chef_clien...
ruby
chosen
[ { "from": "system", "value": "Use rule aliases instead of cryptic names\n" }, { "from": "human", "value": "all\n\nexclude_rule \"MD002\"\n\nexclude_rule \"MD013\"\n\nrule \"MD026\", punctuation: \".,;:!\"\n\nexclude_rule \"MD041\"\n" }, { "from": "gpt", "value": "all\n\nexclude_rule ...
ruby
chosen
[ { "from": "human", "value": "Add Cura.app v15.06.03 (latest beta)\n\nThis Cask has been moved from homebrew-cask and renamed 'cura-beta'.\nIt has been upgraded to the latest version.\n\nPlease find the stable version in homebrew-cask.\n" }, { "from": "gpt", "value": "cask :v1 => 'cura-beta' do\n...
ruby
chosen
[ { "from": "system", "value": "Test against expected width of substitution string\n\nAlso test against behavior when using built-in AFM font.\n" }, { "from": "human", "value": "require 'test_helper'\n\ndescribe Prawn::Emoji::Substitution do\n let(:document) { Prawn::Document.new }\n let(:substi...
ruby
chosen
[ { "from": "system", "value": "Stop browser caching json on browser back.\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery with: :exception\n before_action :configure_permitted_parameters, if: :devise_controller?\n before_action :au...
ruby
chosen
[ { "from": "system", "value": "Remove development hack for loading site; also, use request.host for lookup, not .domain." }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want to use :nul...
ruby
chosen
[ { "from": "system", "value": "Remove the :logged_in authentication hack\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery with: :exception\n\n def require_admin\n # TODO Update when authorization is in place\n redirect_to root_...
ruby
chosen
[ { "from": "system", "value": "Add before action for all controllers to get current season.\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 prote...
ruby
chosen
[ { "from": "system", "value": "Add params to registration step.\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n include DeviseTokenAuth::Concerns::SetUserByToken\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want to use :null_...
ruby
chosen
[ { "from": "human", "value": "Add test structure for `InvoiceLineItem`\n\nThis doesn't come back directly from the API so the suite is empty, but\njust for completeness add a test file for the newly created\n`InvoiceLineItem` model.\n" }, { "from": "gpt", "value": "require File.expand_path('../.....
ruby
chosen
[ { "from": "system", "value": "Update guest users create action" }, { "from": "human", "value": "class GuestUsersController < ApplicationController\n def index\n @guest_users = GuestUser.all\n end\n\n def new\n @guest_user = GuestUser.new\n end\n\n def create\n end\n\n def partial\n ...
ruby
chosen
[ { "from": "system", "value": "Allow projects to be imported into namespaces user is master of.\n" }, { "from": "human", "value": "class Import::BaseController < ApplicationController\n\n private\n\n def get_or_create_namespace\n begin\n namespace = Group.create!(name: @target_namespace...
ruby
chosen
[ { "from": "system", "value": "Include the methodize file in the gem now.\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'httparty'\nrequire 'activesupport'\nrequire 'pp'\n\n$:.unshift File.join(File.dirname(__FILE__),'..','lib')\nrequire 'a2ws/base'\nrequire 'a2ws/item'\nrequire ...
ruby
chosen
[ { "from": "human", "value": "Fix Broken Tax Deinquent Link\n" }, { "from": "gpt", "value": "class NeighborhoodServices::VacancyData::Filters::TaxDelinquent\n START_YEAR = 2015\n\n def initialize(data)\n @addresses = data.dup\n end\n\n def filtered_data\n neighborhood_addresses = @addre...
ruby
chosen
[ { "from": "system", "value": "Bump version up to 0.0.1.\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'feidee_utils'\n s.version = '0.0.0'\n s.date = '2015-05-01'\n s.summary = \"Utils to extract useful information from Feidee Mymoney backu...
ruby
chosen
[ { "from": "system", "value": "Add a new test for PartialFinder and shared partials\n" }, { "from": "human", "value": "require 'test_helper'\n\ndescribe Lotus::View::Rendering::PartialFinder do\n it 'finds the correct partial' do\n partial_finder = Lotus::View::Rendering::PartialFinder.new(Or...
ruby
chosen
[ { "from": "system", "value": "Use a memory repository by default\n" }, { "from": "human", "value": "require 'flop/version'\n\nrequire 'flop/feature'\nrequire 'flop/repository/memory'\nrequire 'flop/repository/redis'\n\nmodule Flop\n class << self\n attr_accessor :repo\n\n def [](feature)\...
ruby
chosen
[ { "from": "human", "value": "Add feature spec for the flexible content duplication.\n" }, { "from": "gpt", "value": "require 'rails_helper'\nrequire_relative '../../pages/login_page'\n\ndescribe 'duplicate flexible content' do\n let(:login_page) { Features::Pages::LoginPage.new }\n let(:email_...
ruby
chosen
[ { "from": "system", "value": "Add pry to debug code\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'similarweb/version'\n\nGem::Specification.new do |spec|\n spec.name = \"...
ruby
chosen
[ { "from": "system", "value": "Fix error when logging in by username\n" }, { "from": "human", "value": "class AuthController < ApplicationController\n def sign_out_action\n sign_out :user\n render json: true\n end\n\n def sign_in_action\n return error! \"Missing parameters\", 400 unle...
ruby
chosen
[ { "from": "system", "value": "Remove forem prefix from forum_topic_path call in link_to_latest_post\n" }, { "from": "human", "value": "module Forem\n module TopicsHelper\n def link_to_latest_post(post)\n text = \"#{time_ago_in_words(post.created_at)} #{t(\"ago_by\")} #{post.user}\"\n ...
ruby
chosen
[ { "from": "system", "value": "Allow for emails to be verified\n" }, { "from": "human", "value": "class OrganizationMailer < ActionMailer::Base\n default :from => %{\"#{ORG::NAME}\" <noreply@#{ORG::DOMAIN}>}\n default :reply_to => %{\"#{ORG::NAME} Support\" <#{ORG::EMAIL}>}\n\n #...
ruby
chosen
[ { "from": "system", "value": "Add author name to the serializer\n" }, { "from": "human", "value": "class PostSerializer < BaseSerializer\n attributes :id, :title, :text, :published_at\n\n def id\n object.slug\n end\nend\n" }, { "from": "gpt", "value": "class PostSerializer < Ba...
ruby
chosen
[ { "from": "system", "value": "Use a request to fetch a server group\n" }, { "from": "human", "value": "module Brightbox\n class ServerGroup < Api\n\n def self.create_server_groups(count,options)\n (0...count).map {|i| create(options) }\n end\n\n def self.create(options)\n new...
ruby
chosen
[ { "from": "system", "value": "Remove unused config method in Logger\n" }, { "from": "human", "value": "module OpenStax\n module RescueFrom\n class Logger\n attr_reader :proxy\n\n def initialize(proxy)\n @proxy = proxy\n end\n\n def record_system_error!(prefix = \"A...
ruby
chosen
[ { "from": "system", "value": "Add some things to the gemspec.\n" }, { "from": "human", "value": "lib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'gravatar-api/version'\n\nGem::Specification.new do |spec|\n spec.name = \"grava...
ruby
chosen
[ { "from": "system", "value": "Use with_locale for menu draw\n" }, { "from": "human", "value": "module AbAdmin\n module Menu\n class Builder < AbstractBuilder\n include ::Singleton\n\n def self.draw(&block)\n I18n.locale = AbAdmin.locale if AbAdmin.locale\n instance.in...
ruby
chosen
[ { "from": "system", "value": "Make it harder to accidently convert ' inside code blocks\n" }, { "from": "human", "value": "module TypographicApostrophe\n class TypographicApostropheGenerator < Jekyll::Generator\n def generate(site)\n site.pages.each { |page| convert(page) }\...
ruby
chosen
[ { "from": "system", "value": "Add retry middleware to API repository\n" }, { "from": "human", "value": "require 'faraday'\nrequire 'faraday/request/request_id'\nrequire 'forwardable'\n\nmodule Core\n module Repositories\n class API\n extend Forwardable\n\n RequestError = Module.ne...
ruby
chosen
[ { "from": "human", "value": "Add capistrano extension file for Capistrano v3" }, { "from": "gpt", "value": "namespace :load do\n\n task :defaults do\n set :eye_config, -> { \"config/eye.yml\" }\n set :eye_bin, -> { \"bundle exec eye-patch\" }\n set :eye_roles, -> { :app }\n end\nend\n...
ruby
chosen
[ { "from": "system", "value": "Work around an ActiveModel bug\n" }, { "from": "human", "value": "module HashBuilder\n # Renders templates with '.json_builder' extension.\n #\n # If the template is a normal view, it will render a JSON string.\n # If the template however is a partial, it render...
ruby
chosen
[ { "from": "system", "value": "Make user frequency option work\n" }, { "from": "human", "value": "require 'securerandom'\n\nmodule CCCB::Core::Choice\n extend Module::Requirements\n\n needs :help\n \n def module_load\n add_command :choice, \"choose\" do |message, args|\n choices = arg...
ruby
chosen
[ { "from": "system", "value": "Add credit fro Clinton on Challenge\n" }, { "from": "human", "value": "# Calculate a Grade\n\n# I worked on this challenge [by myself].\n\n\n# Your Solution Below\ndef get_grade(val)\n\tcase val\n\t\twhen 0..59\n\t\t 'F'\n\t\twhen 60..69\n\t\t 'D'\n\t\twhen 70..79\n...
ruby
chosen
[ { "from": "system", "value": "Add prefix \"::\" to STDOUT for consistency\n" }, { "from": "human", "value": "module Gakubuchi\n module FileUtils\n extend ::FileUtils\n\n class << self\n def copy_p(src, dest)\n mkdir_p(::File.dirname(dest))\n copy(src, dest)\n log...
ruby
chosen
[ { "from": "system", "value": "Use method name that doesn't clash with file\n" }, { "from": "human", "value": "module Rusic\n module Uploaders\n class Asset < Base\n def perform\n client[\"themes/#{theme}/assets/#{file.filename}\"].put(params)\n end\n\n private\n\n ...
ruby
chosen
[ { "from": "system", "value": "Make reset_device also kill the device\n" }, { "from": "human", "value": "module SimCtl\n class Command\n module Create\n COMMAND = %w[xcrun simctl create]\n\n # Creates a device\n #\n # @param name [String] name of the new device\n # @p...
ruby
chosen
[ { "from": "system", "value": "Expire occupation keys after 6 hours\n" }, { "from": "human", "value": "require 'redis'\nrequire 'travis/redis_pool'\n\nmodule Travis\n module Logs\n class Existence\n attr_reader :redis\n\n class << self\n def redis\n @redis ||= RedisP...
ruby
chosen
[ { "from": "system", "value": "Define index action for homepage\n\n- To remove the confusion of where the home page is defined,\n making it easier to understand what is happening\n- Also removing one branch in the layout conditional\n" }, { "from": "human", "value": "class PagesController < Appl...
ruby
chosen
[ { "from": "system", "value": "Add index, show, and create/new actions to PostsController\n" }, { "from": "human", "value": "class PostsController < ApplicationController\n\n\tdef index\n @posts = Post.all \n\tend\n\n\tdef show\n\n\tend\n\n\tdef create\n\n\tend\n\n\tdef new\n\n\tend\n\n\tdef e...
ruby
chosen
[ { "from": "system", "value": "Fix the where clause in Stats\n\nNow properly show the last 90 days of data instead\nof strict quarters.\n\nWith the previous code, on the\n1st of january, april, july and october, only one\nday of data would be shown.\n" }, { "from": "human", "value": "class StatsC...
ruby
chosen
[ { "from": "system", "value": "Make BudError subclass StandardError, not Exception.\n\nThis is apparently what you're supposed to do when defining custom Ruby\nexceptions.\n" }, { "from": "human", "value": "module Bud\n # Root Bud exception type.\n class BudError < Exception; end\n\n # Raised ...
ruby
chosen
[ { "from": "system", "value": "Order the project items the same way as the spreadsheet\n\nOrder by the id field, as this will reflect the order in which the\nitems were imported from the spreadsheet.\n" }, { "from": "human", "value": "class ProjectFilterQuery\n FILTER_TODO = 'to do'.freeze\n FI...
ruby
chosen
[ { "from": "system", "value": "Fix method name; use logger instead of puts\n" }, { "from": "human", "value": "module Synchro\n module Synchronize\n extend ActiveSupport::Concern\n\n included do\n end\n\n module ClassMethods\n def synchronize\n after_create :synchronize\n ...
ruby
chosen
[ { "from": "system", "value": "Fix require statement for new experiment\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire \"#{Rails.root}/lib/experiments/fall2017_cmu_experiment\"\n\nnamespace :experiments do\n desc 'Process Fall 2017 courses for CMU experiment'\n task...
ruby
chosen
[ { "from": "system", "value": "Correct rake task used to clone test dbs\n" }, { "from": "human", "value": "require 'active_record'\nrequire 'multi_spork'\nrequire 'ruby-debug'\n\nnamespace :multi_spork do\n namespace :testdbs do\n desc \"Clone schema of development db to test dbs to be used b...
ruby
chosen
[ { "from": "system", "value": "Add docs for app crumb href option\n" }, { "from": "human", "value": "require 'pathname'\nrequire 'rack'\nrequire 'rack/methodoverride'\nrequire 'rack/protection'\n\nrequire 'flipper'\nrequire 'flipper/middleware/memoizer'\n\nrequire 'flipper/ui/actor'\nrequire 'fli...
ruby
chosen
[ { "from": "system", "value": "Fix CVE-2020-8130 issue with rake\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\n\nrequire 'test_changes/description'\nrequire 'test_changes/summary'\nrequire '...
ruby
chosen