conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Create teble Posts in database\n" }, { "from": "human", "value": "#encoding : utf-8\nrequire 'rubygems'\nrequire 'sinatra'\nrequire 'sinatra/reloader'\nrequire 'sqlite3'\n\ndef init_db\n\tdb = SQLite3::Database.new 'leprosorium.db'\n\tdb.results_as_hash = true\nend\...
ruby
chosen
[ { "from": "system", "value": "Check if URL is correct on redirects.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Dolphy do\n include Rack::Test::Methods\n\n describe \"#get\" do\n it \"returns a page saying Hello on a correct path\" do\n visit '/'\n expect(...
ruby
chosen
[ { "from": "system", "value": "Handle IPv6 IPs without raising exceptions\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'sinatra'\nrequire 'sinatra/activerecord'\nrequire 'socket'\nrequire_relative './relative_date'\n\nset :database, 'postgres://ip:ip@localhost/ips'\n\ndef hostna...
ruby
chosen
[ { "from": "system", "value": "Move Faker::Lorem call out of block to speed up balance_tags_c spec dramatically\n" }, { "from": "human", "value": "$:.unshift File.dirname(__FILE__) # required, for some reason.\nrequire 'spec_helper'\n\n$:.unshift File.dirname(__FILE__) + \"/../ext/balance_tags_c\...
ruby
chosen
[ { "from": "system", "value": "Fix sanitizer text case for glitch-soc, which preserves lists\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'rails_helper'\nrequire Rails.root.join('app', 'lib', 'sanitize_config.rb')\n\ndescribe Sanitize::Config do\n describe '::MASTO...
ruby
chosen
[ { "from": "system", "value": "Add specs for the errors spec\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe RocketPants::Errors do\nend" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe RocketPants::Errors do\n \n describe 'getting all errors' do...
ruby
chosen
[ { "from": "system", "value": "Fix coverage task as it needs to load prior to library\n" }, { "from": "human", "value": "# This file was generated by the `rspec --init` command. Conventionally, all\n# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.\n# Require this file ...
ruby
chosen
[ { "from": "system", "value": "Fix bug with choosing hours that begin with 0.\n" }, { "from": "human", "value": "def datetime_select(field, datetime)\n select datetime.day, from: \"#{field}_3i\"\n select datetime.strftime(\"%B\"), from: \"#{field}_2i\"\n select datetime.year, from: \"#{field}_...
ruby
chosen
[ { "from": "system", "value": "Revert \"Disable false positive of RuboCop\"\n\nThis reverts commit bdb343d791b8d537a9e601a4b73976c6924c9f37.\n" }, { "from": "human", "value": "# coding: utf-8\n\nRSpec.configure do |config|\n config.treat_symbols_as_metadata_keys_with_true_values = true\nend\n\nD...
ruby
chosen
[ { "from": "system", "value": "Add support for RSpec :focus keyword\n" }, { "from": "human", "value": "require 'simplecov'\nSimpleCov.start\n" }, { "from": "gpt", "value": "require 'simplecov'\n# Start the code coverage inspector here so any tests that are run\n# which include the spe...
ruby
chosen
[ { "from": "system", "value": "Fix last rspec deprecation notice.\n" }, { "from": "human", "value": "# This file was generated by the `rspec --init` command. Conventionally, all\n# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.\n# Require this file using `require \"spe...
ruby
chosen
[ { "from": "system", "value": "Fix specs for activerecord 4.0\n" }, { "from": "human", "value": "require 'bundler'\nBundler.require\n\nrequire 'active_record'\nrequire 'database_cleaner'\n\nrequire 'support/fail_helpers'\nrequire 'support/class_helpers'\n\nrequire 'chewy/rspec'\n\nActiveRecord::B...
ruby
chosen
[ { "from": "system", "value": "Make RSpec emit colored output no matter what\n\nWe thought concourse-filter was swallowing color codes. It wasn't: we\nweren't emitting any on CI.\n\n[#133046105]\n" }, { "from": "human", "value": "# encoding: utf-8\nrequire 'tmpdir'\nrequire 'json'\n\nRSpec.config...
ruby
chosen
[ { "from": "system", "value": "Use SimpleCov instead of CodeClimate::TestReporter.\n\n* https://github.com/codeclimate/ruby-test-reporter/blob/master/CHANGELOG.md#v100-2016-11-03\n" }, { "from": "human", "value": "if ENV['CODECLIMATE_REPO_TOKEN']\n require \"codeclimate-test-reporter\"\n CodeCl...
ruby
chosen
[ { "from": "system", "value": "Configure WebMock to disable net connect (Localhost only)\n" }, { "from": "human", "value": "require \"bundler/setup\"\nrequire \"btc_ticker\"\n\nrequire 'webmock/rspec'\n\nRSpec.configure do |config|\n # Enable flags like --only-failures and --next-failure\n conf...
ruby
chosen
[ { "from": "system", "value": "Rework server spawning to work correctly under rspec 1.2\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'spec'\n\n$LOAD_PATH << File.join(File.dirname(__FILE__), \"..\", \"lib\")\nrequire 'resourceful'\n\n$LOAD_PATH << File.dirname(__FILE__) # ./spec...
ruby
chosen
[ { "from": "system", "value": "Add ability to focus a spec\n" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)\nrequire 'refinery/api'\nrequire 'vcr'\nrequire 'pry'\n\nrequire \"support/request_helpers\"\n\nVCR.configure do |c|\n c.cassette_library_dir =...
ruby
chosen
[ { "from": "system", "value": "Configure RSpec output to be more informative\n" }, { "from": "human", "value": "require 'chefspec'\nrequire 'chefspec/berkshelf'\n" }, { "from": "gpt", "value": "require 'chefspec'\nrequire 'chefspec/berkshelf'\n\nRSpec.configure do |config|\n config.f...
ruby
chosen
[ { "from": "system", "value": "Add the correct github url.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'icapps/translations/version'\n\nGem::Specification.new do |spec|\n spec.nam...
ruby
chosen
[ { "from": "system", "value": "Make sure IIS is set to auto\n\nSigned-off-by: Tim Smith <764ef62106582a09ed09dfa0b6bff7c05fd7d1e4@chef.io>\n" }, { "from": "human", "value": "#\n# Author:: Kartik Cating-Subramanian (<ksubramanian@chef.io>)\n#\n# Copyright:: 2015-2016, Chef Software, Inc.\n#\n# Lic...
ruby
chosen
[ { "from": "system", "value": "Use full_title for page titles in DYK list\n" }, { "from": "human", "value": "json.articles do\n json.array! @articles do |article|\n revision = article.revisions.order(wp10: :desc).first\n json.key article.id\n json.title article.title.gsub('_', ' ')\n ...
ruby
chosen
[ { "from": "system", "value": "Load decorators on main app\n" }, { "from": "human", "value": "module Cfp\n class Engine < ::Rails::Engine\n isolate_namespace Cfp\n end\nend\n" }, { "from": "gpt", "value": "module Cfp\n class Engine < ::Rails::Engine\n isolate_namespace Cfp\n\...
ruby
chosen
[ { "from": "system", "value": "Set opened_at if empty when clicked\n" }, { "from": "human", "value": "module Ahoy\n class MessagesController < ActionController::Base\n before_filter :set_message\n\n def open\n if @message and !@message.opened_at\n @message.opened_at = Time.now\...
ruby
chosen
[ { "from": "system", "value": "Set current tennant based of the API token\n" }, { "from": "human", "value": "module Api\n class BaseController < ApplicationController\n protect_from_forgery with: :null_session\n\n skip_before_action :set_current_team\n skip_before_action :run_first_time...
ruby
chosen
[ { "from": "system", "value": "Add URL Query Help Text For Councillor In API Docs\n" }, { "from": "human", "value": "class Api::DocsController < ApplicationController\n\thelper_method :get_url_query_parameters_for\n\n\tCOUNCILLOR_JSON_PATH = Rails.root.join('db/data/api/councillors.json')\n\tITEM...
ruby
chosen
[ { "from": "system", "value": "Rename variables to be more descriptive\n" }, { "from": "human", "value": "# frozen_string_literal: true\nclass LocationController < ApplicationController\n include StringUtils\n\n # GET /es/location/change\n def ask\n end\n\n # POST /es/location/change\n # GE...
ruby
chosen
[ { "from": "system", "value": "Fix rubocop warnings in TopologyController\n" }, { "from": "human", "value": "class TopologyController < ApplicationController\n before_action :check_privileges\n before_action :get_session_data\n after_action :cleanup_action\n after_action :set_session_data\n\n...
ruby
chosen
[ { "from": "system", "value": "Set content type for 404\n" }, { "from": "human", "value": "require 'sinatra/base'\nrequire 'multi_json'\n\nmodule LXC\n class Server < Sinatra::Base\n set :environment, ENV['RACK_ENV'] || 'production'\n\n helpers do\n def json_response(data)\n Mu...
ruby
chosen
[ { "from": "system", "value": "Remove unused reader from Header\n" }, { "from": "human", "value": "require 'rom/header/attribute'\n\nmodule ROM\n # @api private\n class Header\n include Enumerable\n include Equalizer.new(:attributes, :model)\n\n attr_reader :attributes, :model, :mappin...
ruby
chosen
[ { "from": "system", "value": "Fix for new CLAide argument syntax\n" }, { "from": "human", "value": "module Pod\n class Command\n class Spec\n class Doc < Spec\n self.summary = \"Opens the web documentation of a Pod.\"\n\n self.description = <<-DESC\n Opens the web...
ruby
chosen
[ { "from": "system", "value": "Fix mistake from copy & paste\n" }, { "from": "human", "value": "module QuickShoulda\n\tmodule Errors\n\t\tclass InvalidPathError < StandardError\n\t\t\tdef initialize(msg = 'Invalid path given')\n\t\t\t\tsuper(msg)\n\t\t\tend\n\t\tend\n\n\t\tclass FileDoesNotExistE...
ruby
chosen
[ { "from": "system", "value": "Make delegate_to_hash easier to document\n" }, { "from": "human", "value": "module Rpub\n # Delegate missing methods to keys in a Hash atribute on the current object.\n module HashDelegation\n def self.included(base)\n def base.delegate_to_hash(attr)\n ...
ruby
chosen
[ { "from": "system", "value": "Remove CollectionProxy methods from Resource\n" }, { "from": "human", "value": "class SkroutzApi::Resource\n include SkroutzApi::Parsing\n\n attr_accessor :attributes, :client\n\n def initialize(attributes, client)\n @attributes = attributes\n @client = cli...
ruby
chosen
[ { "from": "system", "value": "Move `inbox` into a class attribute\n" }, { "from": "human", "value": "require_relative \"inbox\"\n\nclass EmailVerifier\n attr_reader :missing_alerts, :emailed_alerts, :acknowledged_alerts\n\n ACKNOWLEDGED_EMAIL_CONTENTS = [\n %{subject:\"Field Safety Notice -...
ruby
chosen
[ { "from": "system", "value": "Add wiggle room to openexchangerates polling interval\n" }, { "from": "human", "value": "require 'money/bank/open_exchange_rates_bank'\n\nmoe = Money::Bank::OpenExchangeRatesBank.new\nmoe.ttl_in_seconds = 1.months / 1001 # match free tier on open exchange rates\nmoe...
ruby
chosen
[ { "from": "system", "value": "Add missing `NackError` error subclass\n" }, { "from": "human", "value": "module Fluffle\n module Errors\n class BaseError < StandardError\n def to_response\n {\n 'code' => self.code,\n 'message' => self.message,\n 'data...
ruby
chosen
[ { "from": "system", "value": "Disable compression of javascript to resolve error\n\nSigned-off-by: Michael Barton <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@michaelbarton.me.uk>\n" }, { "from": "human", "value": "require 'extensions/page'\nrequire 'extensions/guide'\n\nactivate :automatic_image_s...
ruby
chosen
[ { "from": "system", "value": "Add possibility to both use guest and password authentication to TC\n" }, { "from": "human", "value": "require 'dotenv'\nDotenv.load\n\nrequire 'dashing'\n\nconfigure do\n set :auth_token, 'YOUR_AUTH_TOKEN'\n\n helpers do\n def protected!\n # Put any authen...
ruby
chosen
[ { "from": "system", "value": "Rename log file to wink.log, which makes more sense\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'sinatra'\nSinatra::Application.default_options.merge!(\n :run => false,\n :env => ENV['RACK_ENV'],\n :raise_errors => true,\n :views => File.join(...
ruby
chosen
[ { "from": "system", "value": "Include modules before constant assignments\n" }, { "from": "human", "value": "require 'rtest/runnable'\nrequire 'rtest/assertions'\n\nmodule Rtest\n class Test < Runnable\n PREFIX = /^test_/\n\n include Assertions\n\n def self.runnable_methods\n meth...
ruby
chosen
[ { "from": "system", "value": "Reduce feature test sleep bakc to what it was\n" }, { "from": "human", "value": "namespace :ci do\n desc 'Run all tests in application-defined order, intended for CI test suite run'\n task :test_suite => :environment do\n raise 'The test suite should only be ru...
ruby
chosen
[ { "from": "human", "value": "TEST: Add unit tests for group_sets_api\n" }, { "from": "gpt", "value": "require 'test_helper'\n\nclass GroupSetsApiTest < ActiveSupport::TestCase\n include Rack::Test::Methods\n include TestHelpers::AuthHelper\n include TestHelpers::JsonHelper\n include TestHelp...
ruby
chosen
[ { "from": "human", "value": "Add 2d least squares method sample script.\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\r\n# coding: utf-8\r\n\r\n# ŏ@ɂ钼 y = a * x + b ̎̎Zo\r\n\r\ns1 = [[32.0, 24.0],\r\n [131.0, 62.0],\r\n [159.0, 110.0],\r\n [245.0, 146.0]]\r\ns2 = [[ 0.0, 0...
ruby
chosen
[ { "from": "system", "value": "Print fail message in case of a failed update request to SP:\n" }, { "from": "human", "value": "require \"net/http\"\nrequire \"uri\"\n\nclass ShareAnalyticsUpdater\n def self.update_shares\n puts \"Fetching data...\"\n\n Share::Button.all.each do |button|\n ...
ruby
chosen
[ { "from": "system", "value": "Update responders requirement from ~> 2.0 to >= 2, < 4\n\nUpdates the requirements on [responders](https://github.com/plataformatec/responders) to permit the latest version.\n- [Release notes](https://github.com/plataformatec/responders/releases)\n- [Changelog](https://github.c...
ruby
chosen
[ { "from": "system", "value": "Use an inline if statement (for rubocop)\n" }, { "from": "human", "value": "require 'csv'\nrequire 'open-uri'\n\ndesc 'Import csv file (run without args for allowed headers)'\ntask :import_csv, [:source_name, :url] => :environment do |_, args|\n if args.any?\n u...
ruby
chosen
[ { "from": "system", "value": "Package version is increased from 2.5.6.0 to 2.5.7.0\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |s|\n s.name = 'evt-messaging'\n s.version = '2.5.6.0'\n s.summary = 'Common primitives for platform-specific messaging im...
ruby
chosen
[ { "from": "system", "value": "Use relative path for capture script.\n" }, { "from": "human", "value": "module AllSeeingPi\n class Camera\n def capture\n `./capture.sh`.strip\n end\n end\nend\n" }, { "from": "gpt", "value": "module AllSeeingPi\n class Camera\n attr_re...
ruby
chosen
[ { "from": "system", "value": "Add staff members in factroy\n" }, { "from": "human", "value": "FactoryGirl.define do\n factory :staff_member do\n \n end\n\nend\n" }, { "from": "gpt", "value": "FactoryGirl.define do\n factory :staff_member do\n sequence(:email){ |n| \"member...
ruby
chosen
[ { "from": "system", "value": "Use dynamic method definition in Unit\n" }, { "from": "human", "value": "module C2y\n class DSL::Context::Unit\n attr_reader :result\n\n def initialize(name, &block)\n @result = OpenStruct.new({\n name: name\n })\n\n instance_eval(&block...
ruby
chosen
[ { "from": "human", "value": "Add a spec for Ranking klass\n" }, { "from": "gpt", "value": "describe Ruboty::DMM::Ranking do\n let(:instance) { described_class.new(command).call }\n\n describe '#call' do\n context 'with 24 argument' do\n subject { instance }\n\n let(:command) { '@r...
ruby
chosen
[ { "from": "system", "value": "PUT /_security messup: the key is \"names\", not \"users\".\n" }, { "from": "human", "value": "require 'net/http'\n\nmodule DatabaseAccess\n ##\n # Sets members and admins for the database.\n #\n # Assumes #admin_credentials returns a Hash containing the keys :u...
ruby
chosen
[ { "from": "system", "value": "Remove min iOS deployment target\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'CargoBay'\n s.version = '0.1.0'\n s.license = 'MIT'\n s.summary = 'The Essential StoreKit Companion.'\n s.homepage = 'https://github.com/mattt/CargoBay'\...
ruby
chosen
[ { "from": "system", "value": "Update MakeMKV to version 1.8.12" }, { "from": "human", "value": "class Makemkv < Cask\n version '1.8.11'\n sha256 '6551e167079d49c4bc414ce9494afae2857338ea5fbcd2ed63d705d2313b48a6'\n\n url 'http://www.makemkv.com/download/makemkv_v1.8.11_osx.dmg'\n homepage 'ht...
ruby
chosen
[ { "from": "system", "value": "Refactor PathsMerger to store schema in HashWithIndifferentAccess\n" }, { "from": "human", "value": "module Swarker\n class PathsMerger\n attr_reader :original_paths, :paths\n\n def initialize(original_paths)\n @original_paths = original_paths\n @pa...
ruby
chosen
[ { "from": "system", "value": "Add environment output to Wego 2xx errors\n" }, { "from": "human", "value": "module Wego\n module Middleware\n class Http < Faraday::Middleware\n # @param [Hash] options\n # @option options [String] :api_key\n # @option options [String] :prefix ur...
ruby
chosen
[ { "from": "system", "value": "Remove automatic geocodings when creating new geocoding\n" }, { "from": "human", "value": "#encoding: UTF-8\nclass Api::Json::GeocodingsController < Api::ApplicationController\n ssl_required :index, :show, :create, :update\n\n def index\n geocodings = Geocoding...
ruby
chosen
[ { "from": "system", "value": "Set I81n locale in FrontendController from params[:language]\n" }, { "from": "human", "value": "# encoding: utf-8\n\n# Abstract controller for all frontend controllers.\nclass PagesCore::FrontendController < ApplicationController\n\n include ApplicationHelper\n\n ...
ruby
chosen
[ { "from": "system", "value": "Update startapp sdk source to use cdn\n" }, { "from": "human", "value": "#\n# Be sure to run `pod spec lint YumiStartAppSDK.podspec' to ensure this is a\n# valid spec and to remove all comments including this before submitting the spec.\n#\n# To learn more about ...
ruby
chosen
[ { "from": "system", "value": "Add ajax_request verification to Pundit gem exception handler\n\nVerification to ajax requests to avoid the update of session[:return_to] on these cases.\n" }, { "from": "human", "value": "module Concerns\n module ExceptionHandler\n extend ActiveSupport::Concern...
ruby
chosen
[ { "from": "system", "value": "Remove unneeded cruft from base invitable serializer\n" }, { "from": "human", "value": "class Invitables::BaseSerializer < ActiveModel::Serializer\n attributes :id,\n :type,\n :name,\n :subtitle,\n :image\n\n def typ...
ruby
chosen
[ { "from": "system", "value": "Update expectations for demo page feature spec\n\nExpecting to see risk categories isn't a good idea because sometimes those categories are empty...\n...so let's expect to see fixed column categories instead.\n" }, { "from": "human", "value": "require 'rails_helper'...
ruby
chosen
[ { "from": "system", "value": "Update specs to account for fix.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Github::PagedRequest do\n\n it { described_class.constants.should include :FIRST_PAGE }\n it { described_class.constants.should include :PER_PAGE }\n\n context '...
ruby
chosen
[ { "from": "human", "value": "Set up initial specs around OData::Query::Criteria.\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe OData::Query::Criteria do\n let(:subject) { OData::Query::Criteria.new(property: :Name) }\n\n it { expect(subject).to respond_to(:property) }\n i...
ruby
chosen
[ { "from": "system", "value": "Fix update and delete operations\n\nFix update operation\nFix delete operation\n" }, { "from": "human", "value": "class CommentsController < ApplicationController\n before_action :authenticate_user!\n \n def create\n @comment = Comment.new(user_params)\n @c...
ruby
chosen
[ { "from": "system", "value": "Use SQL for ordering entries\n" }, { "from": "human", "value": "class ProjectsController < ApplicationController\n def index\n @projects = Project.by_last_updated.paginate(page: params[:page], per_page: 7)\n @entry = Entry.new\n @activities = Entry.last(20...
ruby
chosen
[ { "from": "system", "value": "Update logout route to clear session\n" }, { "from": "human", "value": "get '/login' do\n @user = User.new\n erb :'/login'\nend\n\npost '/login' do\n @user = User.find_by(email: params[:user][:email])\n if @user && @user.password == params[:user][:password]\n ...
ruby
chosen
[ { "from": "system", "value": "Add rake to the development dependancies, for travis-ci.org\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/robut_whois/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Michael Smith\"]\n...
ruby
chosen
[ { "from": "system", "value": "Add remote hands account for TeraSwitch\n" }, { "from": "human", "value": "name \"teraswitch\"\ndescription \"Role applied to all servers at TeraSwitch Networks\"\n\ndefault_attributes(\n :hosted_by => \"TeraSwitch Networks\",\n :location => \"Pittsburgh, Pennsylv...
ruby
chosen
[ { "from": "system", "value": "Change to restrict to Ruby 2.0\n" }, { "from": "human", "value": "lib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'tty/cursor/version'\n\nGem::Specification.new do |spec|\n spec.name = 'tty-curso...
ruby
chosen
[ { "from": "human", "value": "Patch the redmine User model to add another before_save hook.\n" }, { "from": "gpt", "value": "module Plugin\n module Pureftpd\n module User\n def self.included(base)\n base.send(:include, InstanceMethods)\n base.class_eval do\n before...
ruby
chosen
[ { "from": "human", "value": "Update pod spec to 0.1.9\n" }, { "from": "gpt", "value": "Pod::Spec.new do |s|\n s.name = 'SSPPullToRefresh'\n s.version = '0.1.9'\n s.summary = 'General classes for \"Pull-To-Refresh\" concept customisation'\n\n s.description =...
ruby
chosen
[ { "from": "system", "value": "Make Wptemplates::Regexes.an_equals_no_doubleclosebrace_or_pipe accept empty param names\n" }, { "from": "human", "value": "module Wptemplates\n module Regexes\n module_function\n \n def till_doublebrace_or_pipe\n /([^{}|]|{(?!{)|}(?!}))+/\n end\n ...
ruby
chosen
[ { "from": "system", "value": "Use instance variables for request/response data.\n\nI think this would be more friendly for threaded\nservers. I don't think request/response data should\nbe shared.\n" }, { "from": "human", "value": "require 'rack'\nrequire 'json'\n\nmodule Facebook\n module Mess...
ruby
chosen
[ { "from": "system", "value": "Add transparencydata contribution aggregates entity support\n" }, { "from": "human", "value": "module GovKit\n class TransparencyDataResource < Resource\n default_params :apikey => GovKit::configuration.sunlight_apikey\n base_uri GovKit::configuration.transpa...
ruby
chosen
[ { "from": "system", "value": "Use type_class.fetch to get a default value if it exists\n" }, { "from": "human", "value": "require 'protobuf/field/varint_field'\n\nmodule Protobuf\n module Field\n class EnumField < VarintField\n\n ##\n # Public Instance Methods\n #\n\n def...
ruby
chosen
[ { "from": "system", "value": "Use SpecInfra command to check directory exists\n" }, { "from": "human", "value": "require 'serverkit/resources/base'\n\nmodule Serverkit\n module Resources\n class Goget < Base\n attribute :url, required: true, type: String\n\n # @note Override\n ...
ruby
chosen
[ { "from": "system", "value": "Add solution file for 6.2\n" }, { "from": "human", "value": "# Die Class 2: Arbitrary Symbols\n\n\n# I worked on this challenge [by myself, with: ].\n# I spent [#] hours on this challenge.\n\n# Pseudocode\n\n# Input:\n# Output:\n# Steps:\n\n\n# Initial Solution\n\nc...
ruby
chosen
[ { "from": "system", "value": "Improve CSRF strength through new defaults\n\nThis seems like it won't increase our current false flags,\nbecause forms that previously would have been valid should\nstill be valid after this.\n" }, { "from": "human", "value": "# Be sure to restart your server when ...
ruby
chosen
[ { "from": "system", "value": "Update seed file so that a few categories are created off the bat\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 rails db:seed command...
ruby
chosen
[ { "from": "system", "value": "Remove test cases for deployed version.\n" }, { "from": "human", "value": "Exercise.transaction do\n Exercise.delete_all\n\n Exercise.create! path: '1.1.1',\n title: 'How to output numbers',\n color: 'gold',\n yaml: <<END\nassignment: |\n Click Power to ...
ruby
chosen
[ { "from": "system", "value": "Add more permissions to the seed user\n\nAs part of writing E2E tests for Whitehall we want the user to have\naccess to all permissions options, and to have an organisation to\nedit.\n" }, { "from": "human", "value": "if User.where(name: \"Test user\").present?\n p...
ruby
chosen
[ { "from": "system", "value": "Update podspec version to 1.2.0\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'DAAppsViewController'\n s.version = '1.1.0'\n s.platform = :ios\n s.license = 'MIT'\n s.summary = 'DAAppsViewController is a simple way of displaying apps...
ruby
chosen
[ { "from": "system", "value": "Add explanation to routing method\n" }, { "from": "human", "value": "# Shorter routing method for project and project items\nmodule GitlabRoutingHelper\n def project_path(project, *args)\n namespace_project_path(project.namespace, project, *args)\n end\n\n def...
ruby
chosen
[ { "from": "system", "value": "Work around the Catalina issues with sqlplus\n" }, { "from": "human", "value": "# A formula that installs the Instant Client SQLPlus package.\nclass InstantclientSqlplus < Formula\n desc \"Oracle Instant Client SQLPlus x64\"\n homepage \"https://www.oracle.com/dat...
ruby
chosen
[ { "from": "system", "value": "Check for any environment that contains 'test'.\n" }, { "from": "human", "value": "if RAILS_ENV == \"test\"\n\nrequire 'active_support/test_case'\n \n ActionController::Base.perform_caching = true\n \n ActionController::Base.send(:include, Cosinux::PageCacheTest...
ruby
chosen
[ { "from": "system", "value": "Save user and token in context on token creation\n" }, { "from": "human", "value": "# frozen_string_literal: true\nmodule Pragma\n module Devise\n module Token\n module Operation\n class Create < Pragma::Operation::Base\n include Pragma::Dev...
ruby
chosen
[ { "from": "human", "value": "Create unit test to main class.\n" }, { "from": "gpt", "value": "require 'test/unit'\nrequire File.expand_path '../../../lib/raml_poliglota.rb', __FILE__\nrequire File.expand_path '../../../lib/model/execution.rb', __FILE__\n\nclass RamlPoliglotaTest < Test::Unit::Te...
ruby
chosen
[ { "from": "system", "value": "Check method defined in rescue block, add fallback\n" }, { "from": "human", "value": "class ActiveRecordOperationsProcessor < JSONAPI::OperationsProcessor\n private\n\n def transaction\n if @transactional\n ActiveRecord::Base.transaction do\n yield\...
ruby
chosen
[ { "from": "system", "value": "Test for npm availability in sudo context\n\nnpm proxy provider runs\n@machine.communicate.sudo(command).\n\ncap provider verifies availability of npm with `which' NOT\nusing sudo.\n\nThis may result in:\n- which succeeds for the ssh user (mostly vagrant)\n- machine.communicate...
ruby
chosen
[ { "from": "system", "value": "Add latest changes from gitlab-org/gitlab@master\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule PersonalAccessTokens\n class ExpiringWorker\n include ApplicationWorker\n include CronjobQueue # rubocop:disable Scalability/CronWorker...
ruby
chosen
[ { "from": "system", "value": "Fix Coding Style For find_action_item_type_in_item\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want to use :null_session instead.\n protect_from_fo...
ruby
chosen
[ { "from": "system", "value": "Add current_user helper method for quick session grab\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n # Prevent CSRF attacks by raising an exception.\n # For APIs, you may want to use :null_session instead.\n protect_from...
ruby
chosen
[ { "from": "system", "value": "Stop forgery protection from raising exceptions in API calls.\n\nAPI calls don't have the CSRF tokens but are legit so allow them to happen in a\nnull session. They are authenticated every time, so they don't need a real\nsession.\n" }, { "from": "human", "value": "...
ruby
chosen
[ { "from": "system", "value": "Check for local ipv6 address." }, { "from": "human", "value": "# Filters added to this controller apply to all controllers in the application.\n# Likewise, all the methods added will be available for all controllers.\n\nclass ApplicationController < ActionController...
ruby
chosen
[ { "from": "system", "value": "Rename document type to “calculator”\n\nWe want to start using `document_type` in place of the deprecated `format` as the value of the `govuk:format` meta tag when using `govuk_components` (https://github.com/alphagov/static/pull/841).\n\nIn order to not change the current cont...
ruby
chosen
[ { "from": "system", "value": "Use serializer to group environments into folders\n" }, { "from": "human", "value": "class EnvironmentSerializer < BaseSerializer\n entity EnvironmentEntity\nend\n" }, { "from": "gpt", "value": "class EnvironmentSerializer < BaseSerializer\n Struct.new...
ruby
chosen
[ { "from": "system", "value": "Fix converting hash to keyword arguments\n" }, { "from": "human", "value": "class EmailAlertsUnsubscriber\n def self.call(...)\n new(...).unsubscribe\n end\n\n attr_reader :item, :body, :govuk_request_id\n\n def initialize(item:, body: nil, govuk_request_id: ...
ruby
chosen
[ { "from": "system", "value": "Add disabled as an attribute to TextField fields\n" }, { "from": "human", "value": "require \"formalist/element\"\nrequire \"formalist/elements\"\nrequire \"formalist/types\"\n\nmodule Formalist\n class Elements\n class TextField < Field\n attribute :passwo...
ruby
chosen
[ { "from": "system", "value": "Move class definitions in adjustment migration\n" }, { "from": "human", "value": "class AddOrderToAdjustments < ActiveRecord::Migration\n def up\n class Spree::Adjustment < ActiveRecord::Base\n belongs_to :adjustable, polymorphic: true\n belongs_to :or...
ruby
chosen