conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add integration test for God\n" }, { "from": "gpt", "value": "require \"spec_helper\"\n\ndescribe \"practicingruby::_god\" do\n it \"installs god gem\" do\n expect(package \"god\").to be_installed.by \"gem\"\n end\n\n it \"creates god config file\" do\n conf...
ruby
chosen
[ { "from": "system", "value": "Add bson ext as development dep\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/session/version', __FILE__)\n\nGem::Specification.new do |s|\n s.name = 'session'\n s.version = Session::VERSION.dup\n\n s.authors = ['...
ruby
chosen
[ { "from": "system", "value": "Improve specs for class 2 exercise 4\n" }, { "from": "human", "value": "RSpec.describe 'Class 2 Exercise 4' do\n let(:exercise4) do\n load File.expand_path('../../../lib/class2/exercise4.rb', __FILE__)\n end\n\n before do\n stubs = %w(Samuel Leroy Jackson)\...
ruby
chosen
[ { "from": "system", "value": "Fix spec errors related to the Assistant model due to factory refactoring\n" }, { "from": "human", "value": "describe Assistant do\n describe \"relations\" do\n it \"should default to valid\" do\n build(:assistant).should be_valid\n end\n\n it \"shoul...
ruby
chosen
[ { "from": "system", "value": "Move loading of edition in SearchIndexer\n\nWe only need to load the edition when indexing new content. For deleting guides from the index we don't need it.\n" }, { "from": "human", "value": "class SearchIndexer\n def initialize(guide, rummager_index: RUMMAGER_INDE...
ruby
chosen
[ { "from": "system", "value": "Add a dollar sign in a reporter\n" }, { "from": "human", "value": "class CostPerClimbCalculator\n def initialize(climbing_sessions, pass_plan)\n @climbing_sessions = climbing_sessions\n @pass_plan = pass_plan\n end\n\n def cost_per_climb\n @p...
ruby
chosen
[ { "from": "system", "value": "Return the preferred rate daily expiration hour by default\n" }, { "from": "human", "value": "Spree::ShippingCalculator.class_eval do\n preference :rate_daily_expiration_hour, :decimal, default: nil\nend" }, { "from": "gpt", "value": "Spree::ShippingCal...
ruby
chosen
[ { "from": "system", "value": "[FEATURE] Add commented out logging override to generated config file" }, { "from": "human", "value": "# Centralized way to overwrite any Adhearsion platform or plugin configuration\n# - Execute rake adhearsion:config:desc to get the configuration options\n# - Execu...
ruby
chosen
[ { "from": "system", "value": "Add strong params to user_controller\n" }, { "from": "human", "value": "class UsersController < ApplicationController\n\n def new\n \t@user = User.new\n end\nend" }, { "from": "gpt", "value": "class UsersController < ApplicationController\n\n def new...
ruby
chosen
[ { "from": "system", "value": "Order subscriptions by most recently released" }, { "from": "human", "value": "class SubscriptionsController < ApplicationController\n before_action :ensure_logged_in\n\n def index\n @subscriptions = current_user.subscriptions.includes(:project).order('created_...
ruby
chosen
[ { "from": "system", "value": "Update TotalInventoryValue to accept date\n" }, { "from": "human", "value": "module Reports\n module TotalInventoryValue\n def self.new(params, _session)\n if params[:category_id].present?\n Reports::TotalInventoryValue::SingleCategory.new(params)\n ...
ruby
chosen
[ { "from": "system", "value": "Reduce diff with EE in Ci::PipelineTriggerService\n\nSigned-off-by: Rémy Coutable <4ea0184b9df19e0786dd00b28e6daa4d26baeb3e@rymai.me>\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Ci\n class PipelineTriggerService < BaseService\n inc...
ruby
chosen
[ { "from": "system", "value": "Update the version of mustache.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'mustache/sinatra/version'\n\nGem::Specification.new do |spec|\n spec.na...
ruby
chosen
[ { "from": "system", "value": "Reset data source table class before update\n" }, { "from": "human", "value": "class DataSourcesController < ApplicationController\n permits :name, :description, :adapter, :host, :port, :dbname, :user, :password, :encoding\n\n DUMMY_PASSWORD = \"__DUMMY__\"\n\n d...
ruby
chosen
[ { "from": "system", "value": "Use newer version of excon\n" }, { "from": "human", "value": "$:.push File.expand_path('../lib', __FILE__)\n\nrequire 'pco/api/version'\n\nGem::Specification.new do |s|\n s.name = \"pco_api\"\n s.version = PCO::API::VERSION\n s.homepage = \"https://...
ruby
chosen
[ { "from": "system", "value": "Rename env var to REDIS_URL\n" }, { "from": "human", "value": "Lita.configure do |config|\n # Bot name\n config.robot.name = 'unbot'\n\n # The severity of messages to log. Options are:\n # :debug, :info, :warn, :error, :fatal\n # Messages at the selected level ...
ruby
chosen
[ { "from": "system", "value": "Rename + homepage is now github\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'quandl/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "system", "value": "Add all the new node classes to the autoload\n" }, { "from": "human", "value": "require 'cxml/version'\nrequire 'cxml/errors'\nrequire 'time'\nrequire 'nokogiri'\n\nmodule CXML\n autoload :Protocol, 'cxml/protocol'\n autoload :Document, '...
ruby
chosen
[ { "from": "system", "value": "Use relative path for dotfiles symlink.\n" }, { "from": "human", "value": "define :dotfile_install do\n require 'pathname'\n\n source = File.join(REAL_HOME, params[:name])\n target = File.join(node[:dotfiles][:path], params[:name])\n target_exists = File...
ruby
chosen
[ { "from": "system", "value": "Fix UserManagement permissions to allow saving and removing from address book\n" }, { "from": "human", "value": "module Spree\n module PermissionSets\n class UserManagement < PermissionSets::Base\n def activate!\n can [:admin, :display, :create, :upd...
ruby
chosen
[ { "from": "system", "value": "Check remote branches so that works on travisCI\n" }, { "from": "human", "value": "require 'mcrt'\n\ndesc 'Publish release on maven central'\ntask 'publish_to_maven_central' do\n project = Buildr.projects[0].root_project\n password = ENV['MAVEN_CENTRAL_PASSWORD'] ...
ruby
chosen
[ { "from": "system", "value": "Add highlighting for super users\n" }, { "from": "human", "value": "require 'logger'\nrequire 'em-irc'\nrequire 'hipchat'\n\nIRC_HOST = 'irc.freenode.net'\nIRC_PORT = '6667'\nHIPCHAT_ROOM = 'IRC'\n\nHIPCHAT_AUTH_TOKEN = ENV['HIPCHAT_AUTH_TOKEN']\nIRC_CHANNEL = ENV['...
ruby
chosen
[ { "from": "system", "value": "Add header class to mustache template\n" }, { "from": "human", "value": "require 'erb'\nrequire_relative 'template_processor'\n\nmodule Compiler\n class MustacheProcessor < TemplateProcessor\n\n @@yield_hash = {\n page_title: \"{{ pageTitle }}\",\n hea...
ruby
chosen
[ { "from": "system", "value": "Use >= 2.1.0 so that gem installs of newer versions of rails can still run the shoulda tests\n" }, { "from": "human", "value": "# Specifies gem version of Rails to use when vendor/rails is not present\nold_verbose, $VERBOSE = $VERBOSE, nil\nRAILS_GEM_VERSION = '2.1....
ruby
chosen
[ { "from": "system", "value": "Add tests for the nitpick email template\n" }, { "from": "human", "value": "require './test/approval_helper'\n\nrequire 'services/message'\nrequire 'services/nitpick_message'\nrequire 'exercism/exercise'\n\n\nclass NitpickMessageTest < MiniTest::Unit::TestCase\n\n ...
ruby
chosen
[ { "from": "human", "value": "Create a simple string with reverse and upcase method\n" }, { "from": "gpt", "value": "# Solution Below\nold_string = \"Ruby is cool\"\nnew_string = old_string.reverse.upcase \n\n\n\n\n# RSpec Tests. They are included in this file because the local variables you are...
ruby
chosen
[ { "from": "system", "value": "Use public_send instead of send\n" }, { "from": "human", "value": "# coding: utf-8\n\nrequire 'spec_helper'\nrequire 'test/unit/assertions'\n\nshared_examples_for 'ActiveModel' do\n include ActiveModel::Lint::Tests\n include Test::Unit::Assertions\n\n let(:model)...
ruby
chosen
[ { "from": "human", "value": "MIGRATION: Clear the User remember_token and remember_token_expires_at.\n" }, { "from": "gpt", "value": "class ClearRememberTokensForUsers < ActiveRecord::Migration\n def self.up\n User.update_all('remember_token = NULL, remember_token_expires_at = NULL')\n end\...
ruby
chosen
[ { "from": "system", "value": "Use attribute versus hard-coding yarn\n" }, { "from": "human", "value": "#\n# Cookbook Name:: cdap\n# Recipe:: init\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 file excep...
ruby
chosen
[ { "from": "system", "value": "Update `spec.homepage` to github repository.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'methan/version'\n\nGem::Specification.new do |spec|\n spec...
ruby
chosen
[ { "from": "system", "value": "Fix phone number migration to add extension only wherever there is a phone number field\n" }, { "from": "human", "value": "class FixPhoneNumberFields < ActiveRecord::Migration\n def change\n Organization.all.each do |o|\n old_phone = o.phone\n new_phon...
ruby
chosen
[ { "from": "system", "value": "Package version is increased from 0.1.9 to 0.1.10\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'raygun_client'\n s.version = '0.1.9'\n s.summary = 'Client for the Raygun API using the Obsidian HTTP client'...
ruby
chosen
[ { "from": "system", "value": "Add test for fuse recipe\n" }, { "from": "human", "value": "name 'sys'\nmaintainer 'GSI HPC department'\nmaintainer_email 'hpc@gsi.de'\nlicense 'Apache 2.0'\ndescription 'System Software configuration and maintenance'\nlong_descriptio...
ruby
chosen
[ { "from": "system", "value": "Set directory to the default one for each seed file\n" }, { "from": "human", "value": "# This file should contain all the record creation needed to seed the database with its default values.\n# The data can then be loaded with the rake db:seed (or created alongside ...
ruby
chosen
[ { "from": "system", "value": "Update request timeout to 10 minutes\n\nUnder load (generally relating to something upstream like the DB\ncluster being pegged by a 3rd party service), valid but long running\nqueries can be timed out before practical.\n\nThis will allow us to continue to respond in these situa...
ruby
chosen
[ { "from": "system", "value": "Add some dependencies for making my tests\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'the_merger/version'\n\nGem::Specification.new do |ge...
ruby
chosen
[ { "from": "system", "value": "Update grape swagger dependency to 0.6" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'grape-swagger-rails/version'\n\nGem::Specification.new do |spec|\n ...
ruby
chosen
[ { "from": "system", "value": "Change enable queue variable to match our needs\n" }, { "from": "human", "value": "# This file can be overwritten on deployment\n\nset :enable_queue, ! ENV[\"ENABLE_QUEUE\"].nil?\n" }, { "from": "gpt", "value": "# This file can be overwritten on deployme...
ruby
chosen
[ { "from": "system", "value": "Fix variable name for RSpec.configure block GH-29\n" }, { "from": "human", "value": "require 'turnip_formatter'\n\nRSpec.configure do |config|\n c.add_setting :project_name, :default => \"My project\"\n config.add_formatter RSpecTurnipFormatter, 'report.html'\nend...
ruby
chosen
[ { "from": "system", "value": "Fix rubocop violations introduced by changing the defaults\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nlib = File.expand_path('lib', __dir__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'osm/rubocop/version'\n\nGem::Spec...
ruby
chosen
[ { "from": "system", "value": "Make vagrant install wordnet gem since he is the user that will use it\n" }, { "from": "human", "value": "#\n# Cookbook Name:: wordnet\n# Recipe:: default\n#\n#\n# Public domain\n#\n# This project is in the worldwide public domain.\n#\n# This project is in the publi...
ruby
chosen
[ { "from": "system", "value": "Add rake as development depencency\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/ruremai/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = ['hibariya']\n gem.email = ['celluloid.ke...
ruby
chosen
[ { "from": "system", "value": "Handle user names with periods in them.\n" }, { "from": "human", "value": "#\n# Cookbook Name:: user\n# Recipe:: data_bag\n#\n# Copyright 2011, Fletcher Nichol\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file excep...
ruby
chosen
[ { "from": "system", "value": "Fix broken description in gemspec\n" }, { "from": "human", "value": "require \"./lib/redis/spawn/version\"\n\nGem::Specification.new do |s|\n s.name = \"redis-spawn\"\n s.version = Redis::SpawnServer::VERSION\n s.summary = %{An extension to redis-rb to facilitate...
ruby
chosen
[ { "from": "system", "value": "Fix `url` stanza comment for Skreenics.\n" }, { "from": "human", "value": "cask 'skreenics' do\n version '1.0.1'\n sha256 'c4edd3cb8d066c5b5ce8ab78fe476776d04ad5b8e28eb7128bb183903f7dd8b9'\n\n url \"https://storage.googleapis.com/google-code-archive-downloads/v2/...
ruby
chosen
[ { "from": "system", "value": "Fix SHA checksum for Texstudio\n" }, { "from": "human", "value": "cask :v1 => 'texstudio' do\n version '2.8.8'\n sha256 'cd9fd18b0147f43db64af0bb9bb468c9532a8967aa64d1b0aaa09ea98980e91e'\n\n url \"http://downloads.sourceforge.net/sourceforge/texstudio/texstudio_#...
ruby
chosen
[ { "from": "system", "value": "Use postgresql string as service name.\n\nThe minitest service assertion does not appear to use the status\ncommand for the service, instead falling back to process table\ninspection.\n" }, { "from": "human", "value": "#\n# Copyright 2012, Opscode, Inc.\n#\n# Licens...
ruby
chosen
[ { "from": "human", "value": "Test the servers with many sizes of files\n" }, { "from": "gpt", "value": "require 'aws/s3'\nrequire 'pp'\n\nAWS::S3::Base.establish_connection!(\n :access_key_id => \"<Your S3 key>\",\n :secret_ac...
ruby
chosen
[ { "from": "system", "value": "Add url to Repo model\n" }, { "from": "human", "value": "class Repo < ApplicationRecord\n belongs_to :user\n has_many :branches\nend\n" }, { "from": "gpt", "value": "class Repo < ApplicationRecord\n belongs_to :user\n has_many :branches\n\n def url\...
ruby
chosen
[ { "from": "system", "value": "Add spec for -r when the main script file does not exist\n" }, { "from": "human", "value": "require_relative '../spec_helper'\n\ndescribe \"The -r command line option\" do\n before :each do\n @script = fixture __FILE__, \"require.rb\"\n @test_file = fixture _...
ruby
chosen
[ { "from": "system", "value": "Fix attribute type for management_type\n" }, { "from": "human", "value": "module Billimatic\n module Entities\n class InvoiceRule < Base\n attribute :id, Integer\n attribute :gross_value, Decimal\n attribute :description, String\n attribute :...
ruby
chosen
[ { "from": "system", "value": "Clean up images migration script\n" }, { "from": "human", "value": "class CreateImages < ActiveRecord::Migration\n def change\n create_table :images do |t|\n t.integer :width\n t.integer :height\n t.references :document, index: true, foreign_key: ...
ruby
chosen
[ { "from": "human", "value": "Add another migration to link existing line items with their tax categories\n\nRelated to #3481\n" }, { "from": "gpt", "value": "class MigrateTaxCategoriesToLineItems < ActiveRecord::Migration\n def change\n \tSpree::LineItem.includes(:variant => { :product => :tax...
ruby
chosen
[ { "from": "human", "value": "Add AWS::Logs::SubscriptionFilter resource for streaming AWS CloudWatch logs to Kinesis/Lambda\n" }, { "from": "gpt", "value": "require_relative '../resource'\n\nmodule Convection\n module Model\n class Template\n class Resource\n ##\n # AWS::L...
ruby
chosen
[ { "from": "system", "value": "Package version is increased from 0.4.3.1 to 0.4.3.2\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'log'\n s.version = '0.4.3.1'\n s.summary = 'Logging to STD IO with levels, tagging, and coloring'\n s.des...
ruby
chosen
[ { "from": "system", "value": "Add fakeweb gem as dependency\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'skooby/version'\n\nGem::Specification.new do |gem|\n gem.name ...
ruby
chosen
[ { "from": "human", "value": "Add basic spec for league requests page\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe LeagueRequestsController do\n render_views\n\n before do\n @user = create :user\n sign_in @user\n end\n\n describe '#new' do\n context 'for non-adm...
ruby
chosen
[ { "from": "system", "value": "Remove an extra module namespacing\n" }, { "from": "human", "value": "# Public: Generator for admin page controllers.\nmodule CEO\n module Generators\n class AdminGenerator < Rails::Generators::NamedBase\n source_root File.expand_path('../templates', __FILE...
ruby
chosen
[ { "from": "human", "value": "Define specs for implementation of MatchedContributionAttributes\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe MatchedContributionAttributes do\n subject { described_class.new(contribution, match) }\n let(:contribution) do\n Contribution.new...
ruby
chosen
[ { "from": "system", "value": "Remove debug statement from context_admin_required\n" }, { "from": "human", "value": "class Context::Admin::BaseController < ApplicationController\n before_filter :context_admin_required\n \n def index\n \n end\n \n private\n \n def context_admin_required...
ruby
chosen
[ { "from": "system", "value": "Fix test the number of sponsors\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.feature \"Top\", type: :feature do\n describe \"GET /\" do\n scenario \"Sponser links should be exist\" do\n visit \"/\"\n expect(page).to have_css 'sect...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary executables from gemspec\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'sluggi/version'\n\nGem::Specification.new do |spec|\n spec....
ruby
chosen
[ { "from": "system", "value": "Add License Info to the gemspec\n" }, { "from": "human", "value": "# encoding: utf-8\n$:.push File.expand_path('../lib', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = \"fluent-plugin-swift\"\n gem.description = \"OpenStack Storage Service (Swift...
ruby
chosen
[ { "from": "system", "value": "Revert \"Simplify `clj` script and fix some quoting.\"\n\nThis reverts commit fc6f2c88fd080025f128f300c98ce4a66ed3365b.\n" }, { "from": "human", "value": "require 'formula'\n\nclass Clojure <Formula\n url 'http://github.com/downloads/clojure/clojure/clojure-1.2.0.z...
ruby
chosen
[ { "from": "system", "value": "Set podspec tag to reference version.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"ILGHttpConstants\"\n s.version = \"1.0.1\"\n s.summary = \"Constants for HTTP status codes, headers, and method names.\"\n s.homepage ...
ruby
chosen
[ { "from": "system", "value": "Document interface in namespace docs\n\nMSP-10826\n" }, { "from": "human", "value": "module Metasploit\n module Model\n module Search\n # Namespace for search operators\n module Operator\n\n end\n end\n end\nend" }, { "from": "gpt", ...
ruby
chosen
[ { "from": "system", "value": "Test under Rails >= 3.2\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/erd/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = ['Akira Matsuda']\n gem.email = ['ronnie@dio.jp']\n gem...
ruby
chosen
[ { "from": "system", "value": "Check size instead of using .any?\n" }, { "from": "human", "value": "module ROM\n class Repository\n # @api private\n class StructAttributes < Module\n def initialize(attributes)\n super()\n\n define_constructor(attributes)\n\n modul...
ruby
chosen
[ { "from": "system", "value": "Fix comment with usage instructions\n" }, { "from": "human", "value": "require 'pivotal-tracker'\n\n# Usage: ruby pivo.rb <operation> API_TOKEN PROJECT_ID [<params>]\n\nclass Pivo\n attr_reader :project\n\n def initialize(token, project_id)\n PivotalTracker::Cl...
ruby
chosen
[ { "from": "system", "value": "Add compcert.2.5.0 to the black-list\n" }, { "from": "human", "value": "# A list of packages with errors which we chose to ignore (for now). It\n# contains an exact package name together with a string which should be\n# included in the error message.\n\nBlackList = ...
ruby
chosen
[ { "from": "system", "value": "Add Matt Connolly as author\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire File.expand_path('../lib/zmq/version', __FILE__)\n\nGem::Specification.new do |s|\n s.name = \"rbczmq\"\n s.version = ZMQ::VERSION\n s.summary = \"Ruby extension for CZMQ ...
ruby
chosen
[ { "from": "system", "value": "Add author, Github link and description to gemspec\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'rack/rejector/version'\n\nGem::Specification.new do |...
ruby
chosen
[ { "from": "system", "value": "Package version is increased from 0.2.0.1 to 0.2.1.0\n(Tags can be optionally added to the Raygun data)\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'raygun_client'\n s.version = '0.2.0.1'\n s.summary = 'C...
ruby
chosen
[ { "from": "system", "value": "Fix migration to delete the duplicate key which is oldest before adding the unique session key index\n" }, { "from": "human", "value": "class AddUniqueIndexToSessionKeys < ActiveRecord::Migration\n def self.up\n if ENV['RACK_ENV'] != \"production\"\n # Remo...
ruby
chosen
[ { "from": "system", "value": "Use dup method to duplicate the array\n" }, { "from": "human", "value": "# Selection handles selection sort in ascendant order.\n# It provides two methods, one for sorting the array in parameter and\n# the other to return a sorted copy of the array\n# The items of t...
ruby
chosen
[ { "from": "system", "value": "Add rake as a dependency so bundler doesn't get confused\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/temando/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Jason Stirk\"]\n gem.ema...
ruby
chosen
[ { "from": "system", "value": "Handle calls to Rails' application method in specs.\n" }, { "from": "human", "value": "module Rails\n def self.root\n File.join(Dir.pwd, 'tmp')\n end\n \n def self.env\n @@environment ||= 'development'\n end\n \n def self.env=(env)\n @@environment = ...
ruby
chosen
[ { "from": "system", "value": "Fix capitalization in gemspec version\n;\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'takeout/version'\n\nGem::Specification.new do |spec|\n spec.na...
ruby
chosen
[ { "from": "system", "value": "Use stack helper to jump back to stats page after learning a search engine.\n" }, { "from": "human", "value": "class SearchEngineController < Controller\n map '/search_engine'\n\n helper :stack, :user\n\n def index\n redirect_referrer if ! logged_in? || ! use...
ruby
chosen
[ { "from": "system", "value": "Update octokit dependency to 2.4.0\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path('../lib', __FILE__)\n\nrequire 'pronto/version'\n\nGem::Specification.new do |s|\n s.name = 'pronto'\n s.version = Pronto::VERSION\...
ruby
chosen
[ { "from": "system", "value": "Remove gem folder and re-install\n" }, { "from": "human", "value": "# frozen_string_literal: true\nrequire \"bundler/cli/common\"\n\nmodule Bundler\n class CLI::Pristine\n def run\n ::Bundler.load.specs.each do |spec|\n gem_name = \"#{spec.name} (#{s...
ruby
chosen
[ { "from": "system", "value": "Add delegate methods to CT::SessionHandler\n" }, { "from": "human", "value": "module CT\n class SessionHandler\n \n # !@attribute [r] session\n # @return [CT::Session] The active session\n attr_reader :session\n # !@attribute [r] tables\n # @retur...
ruby
chosen
[ { "from": "system", "value": "Enable defaults by calling without parameters\n" }, { "from": "human", "value": "class ENVied\n class Configuration\n attr_reader :current_group, :defaults_enabled, :coercer\n\n def initialize(options = {}, &block)\n @defaults_enabled = options.fetch(:en...
ruby
chosen
[ { "from": "system", "value": "Allow to override description of Rake task\n\nExample:\n\n desc \"Run Foodcritic lint checks\"\n FoodCritic::Rake::LintTask.new\n" }, { "from": "human", "value": "require 'rake'\nrequire 'rake/tasklib'\n\nmodule FoodCritic\n module Rake\n class LintTask < ::Ra...
ruby
chosen
[ { "from": "system", "value": "Add file tests to serverspec\n" }, { "from": "human", "value": "#\n# Copyright (c) 2017 Richard Delaplace\n#\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 ...
ruby
chosen
[ { "from": "system", "value": "Fix Upstart service spec path\n" }, { "from": "human", "value": "# coding: UTF-8\n\nrequire 'spec_helper'\n\ncontext 'when node[zookeeper][service_style] is set to upstart on Ubuntu' do\n describe file '/etc/init/zookeeper' do\n it { is_expected.to be_file }\n ...
ruby
chosen
[ { "from": "human", "value": "Add script that makes it easy to update all locales at once\n" }, { "from": "gpt", "value": "require 'json'\n\nkeys_to_remove = ['mailToDev', 'saveLogFile']\n\nDir.glob('addon/_locales/**/*.json').each do |locale|\n puts locale\n data = JSON.parse(File.open(locale)...
ruby
chosen
[ { "from": "system", "value": "Remove the method before redefining\n" }, { "from": "human", "value": "require \"rails/html/sanitizer/version\"\nrequire \"loofah\"\nrequire \"rails/html/scrubbers\"\nrequire \"rails/html/sanitizer\"\n\nmodule Rails\n module Html\n class Sanitizer\n class <...
ruby
chosen
[ { "from": "system", "value": "Add pry and pry debuggers to common spree dependencies\n\nIncluding dev environment.\n\nFixes #4957\n" }, { "from": "human", "value": "# By placing all of Spree's shared dependencies in this file and then loading\n# it for each component's Gemfile, we can be sure th...
ruby
chosen
[ { "from": "system", "value": "Simplify IRepository tests with a let block\n" }, { "from": "human", "value": "require 'introspection_test_helper'\n\ndescribe GObjectIntrospection::IRepository do\n describe \"an instance\" do\n it \"is not created by calling new()\" do\n assert_raises NoM...
ruby
chosen
[ { "from": "system", "value": "Test for method missing return value.\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass BogusHelperTest < Test::Unit::TestCase\n include ActiveMerchant::Billing::Integrations\n \n def setup\n @helper = Bogus::Helper.new('order-500','cfauser', :...
ruby
chosen
[ { "from": "system", "value": "Set content type if there is a body parameter\n" }, { "from": "human", "value": "require 'diesel/middleware/set_parameter_base'\n\nmodule Diesel\n module Middleware\n class SetBodyParameter < SetParameterBase\n def apply_parameter_value(env, value)\n ...
ruby
chosen
[ { "from": "system", "value": "Use previous datapoints in usage aggregation query\n" }, { "from": "human", "value": "class GithubUsageTracker\n def self.record_datapoint(**args)\n new.record_datapoint(args)\n end\n\n def self.rate_limit_measurements\n new.rate_limit_measurements\n end\n...
ruby
chosen
[ { "from": "system", "value": "Use 'custom.command' key instead of 'context' for the command value.\n" }, { "from": "human", "value": "require 'rails'\nrequire 'rollbar'\n\nAPP_PATH = File.expand_path('config/application', Dir.pwd)\n\nmodule Rollbar\n class RailsRunner\n class GemResolver\n ...
ruby
chosen
[ { "from": "system", "value": "Use delegator for lazy proxy\n" }, { "from": "human", "value": "module Sprockets\n class LazyProxy\n def initialize(&block)\n @block = block\n @proc = nil\n end\n\n def call(*args)\n @proc ||= @block.call\n @proc.call(*args)\n end\n...
ruby
chosen
[ { "from": "system", "value": "Fix rake task to match control file\n" }, { "from": "human", "value": "require 'nokogiri'\n\nnamespace :reason_codes do\n # Example invocation: rails reason_codes:import contrib/Reason\\ codes.xml\n task import: :environment do\n file = File.open ARGV.last\n ...
ruby
chosen
[ { "from": "system", "value": "Remove whitespace as mentioned on bb2abe0\n" }, { "from": "human", "value": "module Sastrawi\n module Dictionary\n class ArrayDictionary\n attr_reader :words\n\n def initialize(words = [])\n @words = []\n\n add_words(words)\n end\n\n...
ruby
chosen
[ { "from": "system", "value": "Make delayed deltas respect the TS.deltas_enabled/TS.updates_enabled flags\n" }, { "from": "human", "value": "require 'delayed/job'\n\nrequire 'thinking_sphinx/deltas/delayed_delta/delta_job'\nrequire 'thinking_sphinx/deltas/delayed_delta/flag_as_deleted_job'\nrequi...
ruby
chosen
[ { "from": "system", "value": "Add comment for pecl channel\n" }, { "from": "human", "value": "#\n# Cookbook Name:: osl-php\n# Recipe:: apc\n#\n# Copyright 2013, Oregon State University\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in ...
ruby
chosen
[ { "from": "system", "value": "Remove explicit dependency on gems in stdlib\n\n`json` is included in the Ruby standard library for all supported versions of Ruby." }, { "from": "human", "value": "Gem::Specification.new do |spec|\n spec.name = 'sentimental'\n spec.version = '1.4.0'\...
ruby
chosen