conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use Github as gem homepage\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'emarsys/version'\n\nGem::Specification.new do |spec|\n spec.name = ...
ruby
chosen
[ { "from": "system", "value": "Move dependency for Rake from development to runtime.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'kondate/version'\n\nGem::Specification.new do |spe...
ruby
chosen
[ { "from": "system", "value": "Speed up /performances API request by sorting appearances after query\n" }, { "from": "human", "value": "json.array! @performances do |performance|\n json.id performance.id.to_s\n json.stage_time performance.stage_time\n json.category_name performance.category.na...
ruby
chosen
[ { "from": "human", "value": "test/cli: Add tests for `kbsecret dump-fields`\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\n\nrequire \"helpers\"\n\n# Tests for KBSecret::CLI::Command::DumpFields\nclass KBSecretCommandDumpFieldsTest < Minitest::Test\n include Helpers\n include ...
ruby
chosen
[ { "from": "system", "value": "Fix problem MongoDB indexing data\n" }, { "from": "human", "value": "class AnalyseResult\n include Mongoid::Document\n include Mongoid::Timestamps\n\n field :module_name, type: String\n field :options, type: Hash\n\n embeds_many :results\n\n def add_array(head...
ruby
chosen
[ { "from": "system", "value": "Check the individual resource status instead of overall status\n" }, { "from": "human", "value": "require 'puppet'\nrequire 'puppet/resource'\nrequire 'puppet/transaction/report'\nrequire 'fpm/cookery/facts'\nrequire 'fpm/cookery/log'\n\n# Init Puppet before using i...
ruby
chosen
[ { "from": "system", "value": "Bump version to add minor usability improvements.\n" }, { "from": "human", "value": "# encoding: utf-8\n\nGem::Specification.new do |s|\n s.name = 'nexpose'\n s.version = '0.2.0'\n s.homepage = 'https://github.com/rapid...
ruby
chosen
[ { "from": "system", "value": "Make GraphvizDot class itself callable\n" }, { "from": "human", "value": "require 'tempfile'\n\nmodule Hexpress\n module Processors\n # Turn embedded dot files into embedded SVGs\n class GraphvizDot\n def initialize(selector)\n @selector = selecto...
ruby
chosen
[ { "from": "system", "value": "Fix style violations in robot-name\n\nRubocop was complaining about a long line. At first I changed\nthe failure message to be a heredoc, which triggered a \"long method\"\nviolation.\n\nThis feels a bit dirty, in that the method is legitimately long, but\nperhaps it's not too ...
ruby
chosen
[ { "from": "system", "value": "Make robo-name test more strict\n" }, { "from": "human", "value": "require 'minitest/autorun'\nrequire_relative 'robot'\n\nclass RobotTest < MiniTest::Unit::TestCase\n def test_has_name\n assert_match /\\w{2}\\d{3}/, Robot.new.name\n end\n\n def test_name_stic...
ruby
chosen
[ { "from": "system", "value": "Replace tabs with spaces in gemspec\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n\ts.name \t\t\t\t\t= \"printnode\"\n s.version\t\t\t\t= \"1.0.6\"\n\ts.date\t\t\t\t\t= \"2015-08-19\"\n\ts.summary\t\t\t\t= \"PrintNode-Ruby\"\n\ts.description\t\t...
ruby
chosen
[ { "from": "system", "value": "Fix forwarded ports destroy method call to use new virtualbox format\n" }, { "from": "human", "value": "module Vagrant\n module Actions\n module VM\n class ForwardPorts < Base\n def prepare\n VirtualBox::VM.all.each do |vm|\n next...
ruby
chosen
[ { "from": "system", "value": "Remove an obsolete development task\n\nThis commit removes an obsolete `:generate_cops_documentation` development task.\nIt's been a year since it was introduced in https://github.com/rubocop/rubocop/commit/1905f1b\nand is no longer in use.\n" }, { "from": "human", ...
ruby
chosen
[ { "from": "system", "value": "Add initial Rack request/response handling classes.\n" }, { "from": "human", "value": "require \"savannah/version\"\nrequire 'rack'\n\nmodule Savannah\n class Main\n def call(env)\n [200, {}, [\"Hello\", \"Whatever\"]]\n end\n end\nend\n" }, { "...
ruby
chosen
[ { "from": "human", "value": "Add ruby file for reflection\n" }, { "from": "gpt", "value": "#Solution Below\nfirst_name = 'Colin'\nlast_name = 'Razevich'\nage = 27\n\n\n\n# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If...
ruby
chosen
[ { "from": "system", "value": "FIX: Use x86 optimized code only when compiling on a x86 CPU.\n- Resolves compilation errors on ARM based processor (defaults to reference code).\n" }, { "from": "human", "value": "require 'mkmf'\n\nFileUtils.rm \"#{$srcdir}/KeccakF-1600-opt.c\", :force => true\n\nc...
ruby
chosen
[ { "from": "system", "value": "Adjust the permissions of the storage symlink\n" }, { "from": "human", "value": "node[:deploy].each do |application, deploy|\n script \"symlink_storage\" do\n interpreter \"bash\"\n user \"root\"\n cwd \"#{deploy[:deploy_to]}\"\n code <<-EOH\n mv cur...
ruby
chosen
[ { "from": "human", "value": "Add http auth state tests.\n" }, { "from": "gpt", "value": "# encoding: UTF-8\n\nrequire 'vines'\nrequire 'minitest/autorun'\n\nclass HttpAuthTest < MiniTest::Unit::TestCase\n def setup\n @stream = MiniTest::Mock.new\n @state = Vines::Stream::Http::Auth.new(@s...
ruby
chosen
[ { "from": "system", "value": "Update Sprinkle example to really be an example of the smallest Sprinkle script possible for deploying a single gem to a remote host, also demonstrates and example of using package recommendations to optionally rely on rubygems\n" }, { "from": "human", "value": "#!/...
ruby
chosen
[ { "from": "system", "value": "Fix the find_property patch to work for objects and not just hashes\n" }, { "from": "human", "value": "class Array\n def find_property(property, value)\n find { |e| e[property.to_s] && e[property.to_s] == value }\n end\nend" }, { "from": "gpt", "val...
ruby
chosen
[ { "from": "system", "value": "Use have_no_link to test presence of button\n" }, { "from": "human", "value": "require 'spec_helper'\n\nfeature 'Pipelines for Merge Requests', feature: true, js: true do\n include WaitForAjax\n\n given(:user) { create(:user) }\n given(:merge_request) { create(:m...
ruby
chosen
[ { "from": "system", "value": "Update Yourkit Java Profiler to 2015-build-15044\n" }, { "from": "human", "value": "cask :v1 => 'yourkit-java-profiler' do\n version '2014-build-14120'\n sha256 '88ae356404b150121522a941dbd5efdaa796b29cbbb7ca4cd173e893bfbbbf51'\n\n url \"http://www.yourkit.com/do...
ruby
chosen
[ { "from": "system", "value": "Replace constructor by factory method for more expressiveness in Gigasecond\n" }, { "from": "human", "value": "require 'minitest/autorun'\nrequire 'date'\nrequire 'time'\nrequire_relative 'gigasecond'\n\nclass GigasecondTest < MiniTest::Unit::TestCase\n\n def test_...
ruby
chosen
[ { "from": "system", "value": "Add test ensuring installer actually unarchives zip\n\nThis will be meaningful once we'll implement the check for the zip in\nthe local cache, as we'll ensure that the archive won't be downloaded\nagain\n" }, { "from": "human", "value": "require \"spec_helper\"\n\nd...
ruby
chosen
[ { "from": "system", "value": "Migrate spec from should to expect\n" }, { "from": "human", "value": "# encoding: utf-8\n\nrequire 'spec_helper'\n\nmodule Rubocop\n module Cop\n describe Cop do\n let (:cop) { Cop.new }\n\n it 'initially has 0 offences' do\n cop.offences.size.s...
ruby
chosen
[ { "from": "system", "value": "Add 'echo' helper method for cross-platform compatibility\n" }, { "from": "human", "value": "require 'timeout'\nrequire 'overcommit/subprocess'\n\n# Helpers for executing shell commands in tests.\nmodule ShellHelpers\n def shell(command)\n Overcommit::Subprocess...
ruby
chosen
[ { "from": "system", "value": "Fix bug with rate limit timing.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Redd\n module Utilities\n # Manages rate limiting by sleeping.\n class RateLimiter\n def initialize(gap = 1)\n @gap = 1\n @last_reque...
ruby
chosen
[ { "from": "system", "value": " Fix typo in courses controller\n" }, { "from": "human", "value": "class CoursesController < ApplicationController\n before_action :authenticate_user!, except: [:index, :show]\n after_action :verify_authorized, except: [:index, :show]\n\n def index\n @cours...
ruby
chosen
[ { "from": "system", "value": "Check for existence of attachment on Problem upload.\n" }, { "from": "human", "value": "module Admin\n class ProblemsController < ApplicationController\n def new\n @contest = Contest.instance\n @problem = @contest.problems.build\n end\n\n def cre...
ruby
chosen
[ { "from": "system", "value": "Delete upload token after upload is complete\n" }, { "from": "human", "value": "class Api::V1::ObjectsController < ApplicationController\n\n before_action :has_permissions?\n\n def create\n object = params[:object][:payload].read\n object_name = Digest::SHA2...
ruby
chosen
[ { "from": "system", "value": "Add show method to Tracking List Controller.\n\nSigned-off-by: Chris Toynbee <9bf3774ab19e71b4502fac9bd506468044cb6bd6@gmail.com>\n" }, { "from": "human", "value": "class TrackingListsController < ApplicationController\n # Prevents the following error from showing ...
ruby
chosen
[ { "from": "system", "value": "Rename create_migration method in generator for Rails 4\n\nRails 4 already has a create_migration method in\nRails::Generators::Migration.\n" }, { "from": "human", "value": "class TheModerator::InstallGenerator < Rails::Generators::Base\n include Rails::Generators:...
ruby
chosen
[ { "from": "system", "value": "Add process method to BogusSimple gateway to be able to process payments.\n\nFixes issue where hitting \"process\" on payments screen breaks with\nBogusSimple gateway.\n\nFixes #3824\n" }, { "from": "human", "value": "# Bogus Gateway that doesn't support payment pro...
ruby
chosen
[ { "from": "system", "value": "Use separate services for GDS/non-GDS editors\n\nWhen the User comes to add an attachment, if they were a GDS editor\nediting a non GDS manual then this would come back with a \"Manual not\nfound\". This commit fixes that by using a new registry which isn't\nscoped to an organi...
ruby
chosen
[ { "from": "system", "value": "Add minitest to the gemspec\n" }, { "from": "human", "value": "# coding: utf-8\n\nGem::Specification.new do |spec|\n spec.name = \"rom-git\"\n spec.version = \"1.0.0\"\n spec.authors = [\"Franck Verrot\"]\n spec.email = [\"franck@ver...
ruby
chosen
[ { "from": "system", "value": "Include payment occurences for the next 30 days in `upcoming`\n" }, { "from": "human", "value": "class PaymentSerializer < ActiveModel::Serializer\n attributes :id, :name, :amount, :category_id, :type, :schedule, :upcoming\n\n def upcoming\n schedule.next_occur...
ruby
chosen
[ { "from": "system", "value": "Change to p from puts\n" }, { "from": "human", "value": "# Format an Address\n\n# I worked on this challenge by myself.\n\n\n# Your Solution Below\n\ndef make_address(street,city,state,zip)\n puts \"You live at #{street}, in the beautiful city of #{city}, #{state}....
ruby
chosen
[ { "from": "system", "value": "Fix for ruby 1.8 (cannot sort arrays of symbols)\n" }, { "from": "human", "value": "module Doorkeeper\n module OAuth\n class Scopes\n include Enumerable\n include Comparable\n\n def self.from_string(string)\n string ||= \"\"\n new.ta...
ruby
chosen
[ { "from": "human", "value": "Add migration refactoring filter paper tables\n" }, { "from": "gpt", "value": "::Sequel.migration do\n change do\n alter_table(:filter_papers) do\n drop_column :number_of_rows\n drop_column :number_of_columns\n end\n\n alter_table(:locations) do\n...
ruby
chosen
[ { "from": "system", "value": "Update status.rb - fix link\n\nFixes documentation links in statuses.rb" }, { "from": "human", "value": "module Octokit\n class Client\n\n # Methods for the Commit Statuses API\n #\n # @see http://developer.github.com/v3/repos/statuses/\n module Statuse...
ruby
chosen
[ { "from": "system", "value": "Use absolute path for asdf\n" }, { "from": "human", "value": "define :asdf_plugin, git: nil do\n git_url = params[:git] ? ' ' + params[:git] : nil\n\n execute \"asdf plugin-add #{params[:name]}#{git_url}\" do\n user node[:user]\n not_if \"test -d ~/.asdf/plu...
ruby
chosen
[ { "from": "system", "value": "Drop the rubyforge entry from the gemspec\n" }, { "from": "human", "value": "\nGem::Specification.new do |s|\n\n s.name = 'rufus-lua'\n\n s.version = File.read(\n File.expand_path('../lib/rufus/lua/version.rb', __FILE__)\n ).match(/ VERSION *= *['\"]([^'\"]+)/...
ruby
chosen
[ { "from": "human", "value": "Add Local Transaction integration test.\n" }, { "from": "gpt", "value": "require 'integration_test_helper'\n\nclass LocalTransactionApiTest < ActionDispatch::IntegrationTest\n setup do\n authority = FactoryGirl.create(:local_authority_with_contact,\n snac: \...
ruby
chosen
[ { "from": "human", "value": "Add missing test class for represented_model concern\n" }, { "from": "gpt", "value": "# encoding: utf-8\n\nrequire 'test_helper'\n\nclass TestRepresentedModel\n include RepresentedModel\nend\n\ndescribe RepresentedModel do\n let(:represented) { TestRepresentedModel...
ruby
chosen
[ { "from": "system", "value": "Add swagger schema for Changelog\n" }, { "from": "human", "value": "module Api\n module Docs\n class Changelogs\n # :nocov:\n include Swagger::Blocks\n\n swagger_path '/srpms/{name}/changelogs' do\n operation :get do\n key :descrip...
ruby
chosen
[ { "from": "system", "value": "Rename callback user_id to username\n" }, { "from": "human", "value": "class CallbackController < ActionController::Base\n\n def reload_slug\n if params[\"slug\"].nil?\n render status: 422, json: {\"errors\" => [\"missing slug parameter\"]}\n elsif param...
ruby
chosen
[ { "from": "system", "value": "Refactor product validity check for destroying features\n" }, { "from": "human", "value": "class FeaturesController < ApplicationController\n before_filter :admin_required\n before_filter :find_feature, :only => [:edit, :destroy, :update]\n def new\n @feature ...
ruby
chosen
[ { "from": "human", "value": "Migrate William Pitt to correct name\n\nhttps://www.pivotaltracker.com/story/show/48923019\n" }, { "from": "gpt", "value": "if william_pitt = Person.find_by_slug('william-lamb-pitt')\n william_pitt.update_column(:slug, 'william-pitt')\n puts \"Changed William Pitt'...
ruby
chosen
[ { "from": "system", "value": "Use decorator for asciicast on homepage\n" }, { "from": "human", "value": "class HomeController < ApplicationController\n def show\n offset = (Asciicast.featured.count * rand).to_i\n @asciicast = Asciicast.featured.offset(offset).first || @asciicasts.first\n...
ruby
chosen
[ { "from": "system", "value": "Enforce ParseTree mode for 1.8.6.\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'ruby2ruby'\n\nbegin\n require 'parse_tree'\n require 'parse_tree_extensions'\nrescue LoadError\n require 'ruby_parser'\n require 'sexp_processor'\n require 'file/t...
ruby
chosen
[ { "from": "system", "value": "Fix up to use TLS for s3\n" }, { "from": "human", "value": "require 'formula'\n\nclass HeliumScript < Formula\n desc \"A command line interface to Helium Script.\"\n homepage 'https://dev.helium.com/downloads'\n version '0.1.0'\n url 'http://helium-public.s3.ama...
ruby
chosen
[ { "from": "system", "value": "Include view helpers for email generation\n" }, { "from": "human", "value": "class ReportEmailSender\n def initialize(report)\n @report = report\n end\n\n def send(address)\n mail = Mail.new do\n from ENV['EMAIL_SENDER']\n subject 'Work you could ...
ruby
chosen
[ { "from": "system", "value": "Fix lookup tables to not use a default scope\n" }, { "from": "human", "value": "class CapitalProjectType < ActiveRecord::Base\n\n # Active scope -- always use this scope in forms\n scope :active, -> { where(active: true) }\n\n def to_s\n name\n end\n\nend\n" ...
ruby
chosen
[ { "from": "system", "value": "Fix commit issue for run process\n" }, { "from": "human", "value": "module Spree\n class ProductExport < ActiveRecord::Base\n has_attached_file :attachment\n validates_attachment :attachment, content_type: { content_type: \"text/csv\" }\n after_commit :run...
ruby
chosen
[ { "from": "system", "value": "[141] Validate all objects before returnig from the SubmissionCreator\n" }, { "from": "human", "value": "class SubmissionCreator\n def self.build(submission_params, answers_params)\n submission = Submission.new(submission_params)\n answers = Answer.collection...
ruby
chosen
[ { "from": "system", "value": "Fix users not working properly\n" }, { "from": "human", "value": "require 'rest_client'\nrequire 'json'\n\nmodule Freshdesk\n class Model\n class << self\n\n attr_accessor :app\n\n def find(id)\n parse(app.client[\"#{@endpoint}/#{id}.json\"].get...
ruby
chosen
[ { "from": "human", "value": "Add tests to check Content API status response\n\nThese tests are stubbing all the possible response codes that the\nContent API might produce and making sure that we're responding\nconsistently within the frontend app.\n" }, { "from": "gpt", "value": "require_relati...
ruby
chosen
[ { "from": "system", "value": "Fix for the case Rails.application.assets is nil\n\ncherry-picking @jvenezia's patch in\nhttps://github.com/haml/haml/pull/868#issuecomment-242689915.\n" }, { "from": "human", "value": "module Haml\n module Filters\n # This is an extension of Sass::Rails's SassT...
ruby
chosen
[ { "from": "system", "value": "Use module_eval to define query scope, and name module\n" }, { "from": "human", "value": "module Mobility\n=begin\n\nModule loading ActiveRecord-specific classes for Mobility models.\n\n=end\n module ActiveRecord\n require \"mobility/active_record/uniqueness_val...
ruby
chosen
[ { "from": "system", "value": "Fix rubocop warnings in GitRepositoryService\n" }, { "from": "human", "value": "class GitRepositoryService\n def setup(git_url, git_username, git_password, verify_ssl)\n new_git_repo = false\n git_repo = GitRepository.find_or_create_by!(:url => git_url) { new...
ruby
chosen
[ { "from": "system", "value": "Remove some extra new lines.\n" }, { "from": "human", "value": "class RecordingParent < BasicObject\n\n class << self\n\n def method_missing(m, *args, &block)\n __missing_class_macros__.push({ m => [args, block].compact })\n end\n\n def __missing_clas...
ruby
chosen
[ { "from": "human", "value": "Add middleware for capturing and wrapping errors.\n" }, { "from": "gpt", "value": "require 'faraday'\nrequire_relative '../error'\n\nmodule Smartsheet\n module API\n module Middleware\n class ErrorTranslator < Faraday::Middleware\n def initialize(app)...
ruby
chosen
[ { "from": "system", "value": "Fix undefined method 'find_asset' for nil:NilClass error\n" }, { "from": "human", "value": "module Princely\n module AssetSupport\n def localize_html_string(html_string, asset_path = nil)\n html_string = html_string.to_str\n # Make all paths relative, ...
ruby
chosen
[ { "from": "system", "value": "Test against local copy of the gem and change methods\n" }, { "from": "human", "value": "# frozen_string_literal: true\nrequire 'audit_tables/version'\n\nmodule AuditTables\n def create_audit_table_for(table_name)\n AuditTables::CreateNewAuditTable.new(table_nam...
ruby
chosen
[ { "from": "system", "value": "Add Darwin (Mac) clause using external osascript\n" }, { "from": "human", "value": "require \"clock_window/version\"\n\nmodule ClockWindow\n class ClockIt\n # As this will get more sophisticated this class is the UI\n def initialize\n @os_cmd = OScommand...
ruby
chosen
[ { "from": "system", "value": "Tweak some documentation in the URL class" }, { "from": "human", "value": "# A bit of a hack to support using an NSURL in MacRuby while still supporting\n# MRI by using the URI module.\n#\n# For any JIRA entity that has a URL object as an instance variable, you can\...
ruby
chosen
[ { "from": "system", "value": "Update dependency version on AFNetworking" }, { "from": "human", "value": "Pod::Spec.new do |s|\n\n # ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #\n #\n # These will help people to find your library, and whilst it\n # can fe...
ruby
chosen
[ { "from": "system", "value": "Fix an issue where you couldn't vote under Ruby 1.9.2 and higher.\n\nCalling instance_eval yields self to any called lambdas, so voting failed every time we tried to look up current_user (see https://gist.github.com/479572).\n\nSo instead, we use a Proc.\n" }, { "from":...
ruby
chosen
[ { "from": "system", "value": "Add 32bit RHEL support for the nagios plugins directory\n\n\nFormer-commit-id: 73bc64ab57e2e2986ee985041d88b2940822a87a [formerly 4c6d5109c5c343f56ea43ac5b1b69969023b6a46] [formerly 2eb2a13bc4b9ec104dbb8c7b739851482f642e8e [formerly e069b4bb04752849f3dc0c48a6223a0c925f313c [for...
ruby
chosen
[ { "from": "system", "value": "Add 404 response for a user without a profile\n" }, { "from": "human", "value": "# pages that contain user information but aren't private\nclass PublicPagesController < ApplicationController\n def search\n end\n\n def profile\n profile_username = params[:usern...
ruby
chosen
[ { "from": "system", "value": "Prepend indentation in one spot\n" }, { "from": "human", "value": "require 'axe/api/value_object'\nrequire 'axe/api/results/checked_node'\n\nmodule Axe\n module API\n class Results\n class Rule < ValueObject\n values do\n attribute :id, ::Sy...
ruby
chosen
[ { "from": "system", "value": "Change bcrypt type to dump a utf-8 string if possible\n\n* This is required by the yaml adapter to properly serialize the\n string into something that can be serialized as a string\n primitive and not a binary string, which is not supported by\n safe_yaml at the moment.\n" ...
ruby
chosen
[ { "from": "system", "value": "Add license to gem spec and fix documentation on gem build\n" }, { "from": "human", "value": "Gem::Specification.new do |gem|\n gem.name = 'log-courier'\n gem.version = '0.9'\n gem.description = 'Log Courier library'\n gem.summary ...
ruby
chosen
[ { "from": "system", "value": "Revert \"Revert \"bundle node into rails 3 slugs :{\"\"\n\nThis reverts commit e9cbc0fe01ea3c0df57e4fa07509c3f992d794b0.\n\nConflicts:\n\n\tlib/language_pack/rails3.rb\n" }, { "from": "human", "value": "require \"language_pack\"\nrequire \"language_pack/rails2\"\n\n...
ruby
chosen
[ { "from": "system", "value": "Check if any social providers are enabled.\n" }, { "from": "human", "value": "module ProfileHelper\n def oauth_active_class provider\n if current_user.provider == provider.to_s\n 'active'\n end\n end\n\n def show_profile_username_tab?\n current_user...
ruby
chosen
[ { "from": "system", "value": "Add publish and withdraw permission check\n" }, { "from": "human", "value": "class PermissionChecker\n GDS_EDITOR_PERMISSION = \"gds_editor\"\n\n def initialize(user)\n @user = user\n end\n\n def can_edit?(format)\n is_gds_editor? || user_organisation_owns...
ruby
chosen
[ { "from": "system", "value": "Add auxiliary methods for parsing\n" }, { "from": "human", "value": "module Nessus\n class Client\n # @author Erran Carey <me@errancarey.com>\n module Policy\n # GET /policy/list\n def policy_list\n resp = get '/policy/list'\n resp['re...
ruby
chosen
[ { "from": "system", "value": "Add documentation as to how the request errors can be handled\n" }, { "from": "human", "value": "module Onfido\n class RequestError < StandardError\n attr_accessor :type, :fields\n end\nend\n" }, { "from": "gpt", "value": "=begin\nThe class will han...
ruby
chosen
[ { "from": "system", "value": "Put this back so test cases pass.\n" }, { "from": "human", "value": "require_relative 'type'\n\nmodule RDL::Type\n class StructuralType < Type\n attr_reader :methods\n\n @@cache = {}\n\n class << self\n alias :__new__ :new\n end\n\n def self.new...
ruby
chosen
[ { "from": "system", "value": "Correct iso code for pound\n" }, { "from": "human", "value": "namespace :spree_multicurrency do\n desc \"Refresh currency rate\"\n task :refresh_currency_rate => :environment do\n resp = Net::HTTP.get_response(URI.parse('http://openexchangerates.org/latest.json...
ruby
chosen
[ { "from": "system", "value": "Use the bbox to build the URL if there is one.\n\n\n" }, { "from": "human", "value": "module GeocoderHelper\n def result_to_html(result)\n html_options = {}\n #html_options[:title] = strip_tags(result[:description]) if result[:description]\n html_options[:...
ruby
chosen
[ { "from": "system", "value": "Add method to map css_class to service_version helper\n" }, { "from": "human", "value": "module ServicesHelper\nend\n" }, { "from": "gpt", "value": "module ServicesHelper\n\n def css_class_for_status(status)\n {\n 'outdated' => 'static',\n ...
ruby
chosen
[ { "from": "system", "value": "Store image resolution to proper attributes instead of width/height\n" }, { "from": "human", "value": "module Flms\n class ImageLayer < Layer\n attr_accessible :image, :image_cache\n\n mount_uploader :image, ImageUploader\n before_save :retain_geometry\n\n...
ruby
chosen
[ { "from": "system", "value": "Verify that changing an attribute's value doesn't break anything\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass AttributeAssemblerTest < AttributeAssembler::TestCase\n\n def setup\n setup_environment\n @person = Person.create :name => 'John...
ruby
chosen
[ { "from": "system", "value": "Improve controller tests for an initiative.\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass InitiativesControllerTest < ActionDispatch::IntegrationTest\n\n def setup\n @user = users(:admin)\n log_in_as(@user)\n end\n\n test \"should get ne...
ruby
chosen
[ { "from": "system", "value": "Fix rom version spec for beta\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'rom/sql/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "human", "value": "Add a complete test for the BatchResult class.\n" }, { "from": "gpt", "value": "require 'test_helper'\n\nclass TestBatchResult < Test::Unit::TestCase\n \n def setup\n @result_created = SalesforceBulk::BatchResult.new('123', true, true, '')\n @result_updated =...
ruby
chosen
[ { "from": "system", "value": "Update spec to wait for the link to appear\n" }, { "from": "human", "value": "require 'rails_helper'\n\nfeature 'Likeable', :js => true do\n let(:member) { FactoryGirl.create(:member) }\n let(:another_member) { FactoryGirl.create(:london_member)}\n let(:post) { F...
ruby
chosen
[ { "from": "system", "value": "Add missing dependency for Beaker tests\n" }, { "from": "human", "value": "require 'beaker-rspec/helpers/serverspec'\nrequire 'beaker-rspec/spec_helper'\nrequire 'beaker/puppet_install_helper'\n\nrun_puppet_install_helper\n\nSUPPORTED_PLATFORMS = ['Debian'].freeze\n...
ruby
chosen
[ { "from": "system", "value": "Increment queue length to reduce request times.\n" }, { "from": "human", "value": "require 'yaml'\nrequire 'librato/metrics'\nmetrics_config_file = Rails.root.join('config', 'metrics.yml')\n\nif !Rails.env.test? && File.exists?(metrics_config_file)\n metrics_config...
ruby
chosen
[ { "from": "system", "value": "Fix errant ENV reference to REDIS_HOST\n\nThis is just a typo, and a cost of not having CI running. Mea Culpa on both\ncounts.\n" }, { "from": "human", "value": "Sidekiq.configure_server do |config|\n config.redis = { url: \"redis://#{REDIS_HOST}:6379/0\" }\nend\n\...
ruby
chosen
[ { "from": "system", "value": "Add errors on :password when digest is missing\n" }, { "from": "human", "value": "require \"sequel_secure_password/version\"\nrequire \"bcrypt\"\n\nmodule Sequel\n module Plugins\n module SecurePassword\n\n # Configure the plugin by setting the available op...
ruby
chosen
[ { "from": "human", "value": "Fix AR timezone from local to utc\n" }, { "from": "gpt", "value": "class ChangeDatetimeTimezones < ActiveRecord::Migration\n\n # set to 1.0.0 migration date\n FromDate = ENV['CHANGE_TIMEZONE_FROM'] || '2014/11/24 00:00:00'\n\n def up\n # from local to utc\n ...
ruby
chosen
[ { "from": "human", "value": "Add formula for WebStorm with bundled JDK\n\nSee #879\n" }, { "from": "gpt", "value": "cask :v1 => 'webstorm-bundled-jdk' do\n version '10.0.1'\n sha256 '8b05be91e5c688908d6bcaab4d1f5ead86912d5b33b332a7dd5964dc901090b7'\n\n url \"https://download.jetbrains.com/web...
ruby
chosen
[ { "from": "system", "value": "Change expiration to 10 minutes\n" }, { "from": "human", "value": "require 'sinatra'\nrequire 'sinatra/flash'\nrequire 'haml'\nrequire 'redis'\n\nenable :sessions\n\nget '/' do\n haml :index\nend\n\npost '/post' do\n charset = %w{ 2 3 4 6 7 9 a c d e f g h j k m n...
ruby
chosen
[ { "from": "system", "value": "Revert the change to the session management : didn't work on AppFog\n" }, { "from": "human", "value": "# encoding: utf-8\nrequire 'sinatra'\nrequire 'sinatra/multi_route'\nrequire 'sinatra/namespace'\nrequire 'sinatra/r18n'\nrequire 'sinatra/flash'\n\nrequire 'haml'...
ruby
chosen
[ { "from": "human", "value": "Add a test case to examine mime type handling\n" }, { "from": "gpt", "value": "class IRubyTest::MimeTest < IRubyTest::TestBase\n sub_test_case(\"IRuby::Display\") do\n def test_display_with_mime_type\n html = \"<b>Bold Text</b>\"\n\n obj = Object.new\n ...
ruby
chosen
[ { "from": "system", "value": "Change $redis.info as connection test to $redis.ping\n" }, { "from": "human", "value": "ACCOUNT_SID = ENV[\"TWILIO_ACCOUNT_SID\"]\nfail \"no TWILIO_ACCOUNT_SID environment variable\" unless ACCOUNT_SID\n\nAUTH_TOKEN = ENV[\"TWILIO_AUTH_TOKEN\"]\nfail \"no TWILIO_AUT...
ruby
chosen
[ { "from": "human", "value": "Add code wars (8) - squash the bugs\n" }, { "from": "gpt", "value": "# http://www.codewars.com/kata/56f173a35b91399a05000cb7/ \n# --- iteration 1 ---\ndef find_longest(str)\n str.split.map(&:size).max\nend\n" } ]
ruby
chosen
[ { "from": "system", "value": "Add rspec to development dependencies.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/upstart/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = 'upstart'\n gem.version = Upstart::VERS...
ruby
chosen