conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "human", "value": "Add spec for file manager, since it appears we are going to use it for now\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\nRSpec.describe ImageFileManager, :type => :model do\n\n before do\n setup_test_public_dir\n\n @test_file = File.join(TEST_FILE...
ruby
chosen
[ { "from": "human", "value": "Add a tool to assist in reconnecting vms\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\nrequire File.expand_path('../config/environment', __dir__)\nrequire \"optimist\"\n\nopts = Optimist.options do\n opt :ems_id, \"The ID of the ExtManagementSystem to reconn...
ruby
chosen
[ { "from": "system", "value": "Add required Ruby version to gemspec\n" }, { "from": "human", "value": "# coding: utf-8\n# frozen_string_literal: true\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'japanese_calendar/version'\n\nGem::S...
ruby
chosen
[ { "from": "system", "value": "Use a different title for signup pages\n\nIf a different title for signup pages is present in the metadata hash\nuse that instead.\n" }, { "from": "human", "value": "class FinderSignupContentItemPresenter < ContentItemPresenter\n def title\n metadata[\"name\"]\n...
ruby
chosen
[ { "from": "system", "value": "Use matrix hash as optimizer cache key\n" }, { "from": "human", "value": "# Copyright © Mapotempo, 2013-2014\n#\n# This file is part of Mapotempo.\n#\n# Mapotempo is free software. You can redistribute it and/or\n# modify since you respect the terms of the GNU Affer...
ruby
chosen
[ { "from": "system", "value": "Disable HostAuthorization middleware in testing.\n\nhttps://stackoverflow.com/a/56238430\n" }, { "from": "human", "value": "require 'action_controller/railtie'\nrequire 'rails_event_store/railtie'\nrequire 'securerandom'\n\nclass TestApplication < Rails::Application...
ruby
chosen
[ { "from": "system", "value": "Add spec for SVN directory name containing `@`.\n" }, { "from": "human", "value": "require_relative \"shared_examples\"\n\ndescribe UnpackStrategy::Subversion do\n let(:repo) {\n mktmpdir.tap do |repo|\n system \"svnadmin\", \"create\", repo\n end\n }\n...
ruby
chosen
[ { "from": "system", "value": "Remove and simplify checks now that we're using package.json versioning.\nAlso, remove unused leftover values.\n" }, { "from": "human", "value": "require 'json'\nrequire 'progress_bar'\nrequire 'open-uri'\nrequire 'digest/sha1'\n\nclass Array\n include ProgressBar:...
ruby
chosen
[ { "from": "system", "value": "Revert \"reduce number of objects\"\n\nThis reverts commit 59d71b6e525274c861bfcbd0142f7753473f4d4a.\n\nConflicts:\n\tlib/action_args/abstract_controller.rb\n\nreason: compacting all parameters will eliminate nil parameters\n" }, { "from": "human", "value": "module ...
ruby
chosen
[ { "from": "system", "value": "Add domain for session store:\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\nRails.application.config.session_store :cookie_store, key: '_findingaids_session'\n" }, { "from": "gpt", "value": "# Be sure t...
ruby
chosen
[ { "from": "system", "value": "Make our session cookie good across all subdomains\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\nPaperSearchApi::Application.config.session_store :cookie_store, key: '_science_commons_api_session'\n" }, { "...
ruby
chosen
[ { "from": "system", "value": "Make the session cookie key dependent on the Rails environment.\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\n# Your secret key for verifying cookie session data integrity.\n# If you change this key, all old sessio...
ruby
chosen
[ { "from": "system", "value": "Switch away from deprecated skip_before_filter" }, { "from": "human", "value": "# name: discourse_sso_redirect\n# about: allows a whitelist for SSO login redirects\n# version: 0.1\n# authors: Gregory Avery-Weir\n\nafter_initialize do\n SessionController.class_eval ...
ruby
chosen
[ { "from": "system", "value": "Fix \"Permission denied\" error when touching ruby.exe\n\nSee https://ci.appveyor.com/project/larskanis/rubyinstaller2-hbuor/builds/30223212/job/sjxb12w5bg86hwqn\n" }, { "from": "human", "value": "file ruby_exe => [self.repo_added] do\n # pacman doesn't work on aut...
ruby
chosen
[ { "from": "system", "value": "Put deprecated fields back on Submission table.\n\nThey can be deleted when the proper join tables have been implemented.\n" }, { "from": "human", "value": "class CreateSubmissions < ActiveRecord::Migration\n def change\n create_table :submissions do |t|\n ...
ruby
chosen
[ { "from": "system", "value": "Work in non-flat directory structures. No args for all songs.\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'yaml'\n\nclass Marcato\n VERSION = '0.0.2'\n MARCATO_FILE = ENV['MARCATO_FILE'] || \"#{ENV['HOME']}/.marcato\"\n MARCATO_MUSIC = File.ex...
ruby
chosen
[ { "from": "system", "value": "Fix specs for ruby 1.9\n\nForce to create Array from @cwe\n" }, { "from": "human", "value": "module Scanny\n class Issue\n attr_reader :file, :line, :impact, :message, :cwe\n\n def initialize(file, line, impact, message, cwe = nil)\n @file, @line, @impac...
ruby
chosen
[ { "from": "human", "value": "Add Homebrew formula for 1.1.2\n" }, { "from": "gpt", "value": "class Fu < Formula\n desc \"intuitive alternative to the find utility\"\n homepage \"https://github.com/kbrgl/fu\"\n url \"https://github.com/kbrgl/fu/archive/v1.1.2.tar.gz\"\n sha256 \"34dd0eade8842...
ruby
chosen
[ { "from": "system", "value": "Fix google_oauth2 hd check: fix hd option fetching\n" }, { "from": "human", "value": "class Kuroko2::SessionsController < Kuroko2::ApplicationController\n skip_before_action :require_sign_in\n\n def new\n render layout: false\n end\n\n def create\n return_...
ruby
chosen
[ { "from": "system", "value": "Fix crash on adding character to chronicle\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\n# Broadcasts whenever a Chronicle's list of characters/etc changes\nclass ChronicleCharactersBroadcastJob < ApplicationJob\n queue_as :default\n\n def pe...
ruby
chosen
[ { "from": "system", "value": "Remove unused code in DSU\n\nThis isn't used anymore now that we define this using the Finder in the\nDocument Presenter.\n" }, { "from": "human", "value": "class DrugSafetyUpdatePresenter < DocumentPresenter\n delegate(\n :therapeutic_area,\n :first_publishe...
ruby
chosen
[ { "from": "human", "value": "Add a rake task to cache any missing_responses that have not been cached\n\nOnly those that have Campaigns associated, because that's the only place we use them\n" }, { "from": "gpt", "value": "namespace :cache do\n desc \"Caches uncached missing_responses\"\n task...
ruby
chosen
[ { "from": "system", "value": "Update log to default to info log level\n" }, { "from": "human", "value": "require \"logger\"\n\nmodule YARD\n class Logger < ::Logger\n def debug(*args)\n self.level = Logger::DEBUG if $DEBUG\n super\n end\n \n def enter_level(new_level = Log...
ruby
chosen
[ { "from": "system", "value": "Fix for podspec to prevent inclusion of scripts and binaries into a client package.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"libObjCAttr\"\n s.version = \"1.3.4\"\n s.summary = \"Attribute-oriented program...
ruby
chosen
[ { "from": "system", "value": "Document how Nanite agents can participate in distrubuted processing using topic queues and push_to_exchange/subscribe_to_exchange.\n\nSigned-off-by: ezmobius <4aca359fa1b78e51bc8226c4f161d16fdc1e21c8@engineyard.com>\n" }, { "from": "human", "value": "module Nanite\...
ruby
chosen
[ { "from": "system", "value": "Add gem summary and description\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n\nlib = File.expand_path '../lib', __FILE__\n$LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib\n\nrequire 'tp/version'\n\nGem::Specification.new do |gem|\n gem.name ...
ruby
chosen
[ { "from": "system", "value": "Fix tests autorun for Rails >= 4\n" }, { "from": "human", "value": "require 'pathname'\n\nrequire 'test/unit'\nrequire 'active_support/test_case'\n\nrequire 'active_record'\nrequire 'active_record/fixtures'\n\nrequire 'action_controller'\n# require 'action_dispatch'...
ruby
chosen
[ { "from": "human", "value": "Create IntegerEx module to expand Integer class\n" }, { "from": "gpt", "value": "module IntegerEx\n refine Integer.singleton_class do\n def max()\n n_bytes = [42].pack('i').size\n n_bits = n_bytes * 16\n 2 ** (n_bits - 2) - 1\n end\n\n def mi...
ruby
chosen
[ { "from": "system", "value": "Revert version bump since this is a CI change only\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'hiera-simulator'\n s.version = '0.3.0'\n s.authors = 'Kevin Paulisse'\n s.date = Time.now.strftime('%Y-%m-%d')\n...
ruby
chosen
[ { "from": "system", "value": "Add guard to not bail in Bank.to_s without vcard.\n" }, { "from": "human", "value": "class Bank < ActiveRecord::Base\n has_many :bank_accounts\n\n has_vcards\n\n def to_s\n [vcard.full_name, vcard.locality].compact.join(', ') \n end\nend\n" }, { ...
ruby
chosen
[ { "from": "system", "value": "Update to the global stats at the end of 2017:\n\n> ending the year with 1,600 Dojos running regularly in 85 countries\ncf. Happy New Year from the CoderDojo Foundation\nhttps://youtu.be/l68CNoby_bg\n" }, { "from": "human", "value": "class Dojo < ApplicationRecord\n...
ruby
chosen
[ { "from": "system", "value": "Fix Unit key validation regex\n" }, { "from": "human", "value": "class Unit < ActiveRecord::Base\n include FedoraObjectAssociations\n\n has_many :memberships, dependent: :destroy\n has_many :members, through: :memberships, source: :user\n\n belongs_to :admin_pol...
ruby
chosen
[ { "from": "system", "value": "Add null object to reactive response." }, { "from": "human", "value": "module NoaaClient\n module Responses\n module ReactiveXmlResponse\n def method_missing(method_name, *arguments, &block)\n if tag = source.css(method_name.to_s)\n if block...
ruby
chosen
[ { "from": "system", "value": "Fix bug concerning length of horizontally drawn segment\n\nArgument x2 in Bitmap#draw_h is exact column, no need to calculate the\nsegment's legnth\n" }, { "from": "human", "value": "class Bitmap\n\n # expose bitmap and dimensions getters\n attr_reader :bm, :rows,...
ruby
chosen
[ { "from": "system", "value": "Fix down migration for removing node index\n" }, { "from": "human", "value": "class RemoveCurrentServerStatusIndex < ActiveRecord::Migration\n disable_ddl_transaction!\n\n def change\n remove_index(:nodes, name: :index_nodes_on_current_server_status, algorithm:...
ruby
chosen
[ { "from": "human", "value": "Add unit tests for the druid::indexing::middle_manager class.\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe 'druid::indexing::middle_manager', :type => 'class' do\n context 'On system with 10 GB RAM and defaults for all parameters' do\n let(:...
ruby
chosen
[ { "from": "system", "value": "Make sure readline is required for test\n" }, { "from": "human", "value": "describe \"Escort basic app that requires arguments\", :integration => true do\n subject { Escort::App.create(option_string, &app_configuration) }\n\n let(:app_configuration) do\n lambda...
ruby
chosen
[ { "from": "system", "value": "Change Atom download to HTTPS\n" }, { "from": "human", "value": "class Atom < Cask\n url 'http://atom.io/download/mac'\n homepage 'http://atom.io'\n version 'latest'\n sha256 :no_check\n link 'Atom.app'\n binary 'Atom.app/Contents/Resources/app/apm/node_module...
ruby
chosen
[ { "from": "system", "value": "Fix homepage to use SSL in Flow Cask\n\nThe HTTP URL is already getting redirected to HTTPS. Using the HTTPS URL directly\nmakes it more secure and saves a HTTP round-trip.\n" }, { "from": "human", "value": "cask :v1 => 'flow' do\n version :latest\n sha256 :no_che...
ruby
chosen
[ { "from": "system", "value": "Fix `url` stanza comment for Toad.\n" }, { "from": "human", "value": "cask 'toad' do\n version '2.4.0'\n sha256 '74f7d6a26c0bd5eaec2c3d2e02994fe9e89131e3f1baa8742416f9dc6222e4af'\n\n # http://community-downloads.quest.com/toadsoft/ was verified as official when f...
ruby
chosen
[ { "from": "system", "value": "Update YNAB 4 from 4.3.451 to 4.3.541\n\nRedo of PR #5084 overwritten by commit d4605c8." }, { "from": "human", "value": "class Ynab < Cask\n version '4.3.451'\n sha256 '088f61e0e772193f6dac61e22067b1696246f214d7c9887f95d180cfabb57e25'\n\n url 'https://www.younee...
ruby
chosen
[ { "from": "system", "value": "Change model tested to correct model\n\nChange model tested from Spree::Calculator::PriceSack to\nSpree::Calculator::Shipping::PriceSack.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Spree::Calculator::PriceSack, type: :model do\n let(:calcu...
ruby
chosen
[ { "from": "system", "value": "Change swagger doc mount path.\n" }, { "from": "human", "value": "require_relative 'v0/api'\nrequire 'grape-swagger'\n\nclass ApiV0 < Grape::API\n\n get do\n # Redirect base url to Swagger docs\n redirect \"http://petstore.swagger.io/?url=#{request.scheme}://...
ruby
chosen
[ { "from": "system", "value": "Put the Ruby version requirement within the 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 'xo/version'\n\nGem::Specification.new do |spec|\n s...
ruby
chosen
[ { "from": "human", "value": "Add test coverage for number helper\n" }, { "from": "gpt", "value": "describe JsonTestData::NumberHelper do\n include JsonTestData::NumberHelper\n\n describe \"#adjust_for_maximum\" do\n context \"no maximum\" do\n let(:number) { 3 }\n\n it \"returns t...
ruby
chosen
[ { "from": "system", "value": "Add sqlite3 development dependency for testing db\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'disqus_rails/version'\n\nGem::Specification.new do |sp...
ruby
chosen
[ { "from": "system", "value": "Change test to pass with changes made to view.\n" }, { "from": "human", "value": "require \"#{File.dirname(__FILE__)}/../test_helper\"\n\nclass MultisiteTest < ActionController::IntegrationTest\n def setup\n Setting.set_global('Features', 'Multisite', true)\n e...
ruby
chosen
[ { "from": "system", "value": "Enable :focus option in rspec\n" }, { "from": "human", "value": "require \"simplecov\"\nSimpleCov.start\n\n$LOAD_PATH.unshift File.expand_path(\"../../lib\", __FILE__)\nrequire \"guideline\"\n" }, { "from": "gpt", "value": "require \"simplecov\"\nSimpleC...
ruby
chosen
[ { "from": "system", "value": "Change to remove ruby version check, update formatter to use new api and use double quoted strings\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nif RUBY_VERSION > '1.9' and (ENV['COVERAGE'] || ENV['TRAVIS'])\n require 'simplecov'\n require 'c...
ruby
chosen
[ { "from": "system", "value": "Use \"RSpec\" instead of deprecated \"Rspec\".\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'rspec'\nrequire 'mocha'\n$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), *%w[.. lib]))\nrequire 'mimic'\nrequire 'rspec/expectations'\n\nRspec.configu...
ruby
chosen
[ { "from": "system", "value": "Update coveralls setting to detect all files in library\n" }, { "from": "human", "value": "ENV[\"RAILS_ENV\"] ||= \"test\"\n\nrequire 'bundler/setup'\nBundler.setup\n\nrequire 'simplecov'\nrequire 'coveralls'\nSimpleCov.formatter = Coveralls::SimpleCov::Formatter\nS...
ruby
chosen
[ { "from": "system", "value": "Rename spec double `manual_section` -> `section`\n\nWe renamed SpecialistDocument to Section in 9b0ef01e0. ManualSection\nis another synonym for Section so this commit renames for\nconsistency.\n" }, { "from": "human", "value": "require \"spec_helper\"\nrequire \"fo...
ruby
chosen
[ { "from": "system", "value": "Make project links consistent with user links\n" }, { "from": "human", "value": "module Api\n module V1\n class ProjectSerializer < ActiveModel::Serializer\n include ApplicationHelper\n\n attributes :id, :slug, :name, :short_description, :description,\...
ruby
chosen
[ { "from": "system", "value": "Add created at from imported item\n" }, { "from": "human", "value": "class ImportConnectionDataWorker\n include Sidekiq::Worker\n sidekiq_options queue: 'urgent', retry: 5\n\n # rubocop:disable Metrics/MethodLength\n # rubocop:disable Metrics/AbcSize\n def perf...
ruby
chosen
[ { "from": "system", "value": "Make session cookie domain :all for single sign out\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\nRooms::Application.config.session_store :cookie_store, key: '_room_reservation_session'#, :domain => ENV['ROOMS_COOK...
ruby
chosen
[ { "from": "human", "value": "Add tests for setting trusted_proxies\n\nEach test reloads the trusted_proxies initializer, which in turn will set Rails.application.config.action_dispatch.trusted_proxies to something new. This will leak into the other tests, but the middleware that it is used in has already be...
ruby
chosen
[ { "from": "system", "value": "Remove test relating to CanonicalTemperature class\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe CanonicalTemperature do\n describe \"getting readings\" do\n it \"saves a new record when a reading is not found\" do\n zip_code = 1000...
ruby
chosen
[ { "from": "system", "value": "Fix typo after changing namespace\n" }, { "from": "human", "value": "module SpreeShopifyImporter\n module Importers\n class OrderImporter < BaseImporter\n def import!\n if (old_data_feed = find_existing_data_feed).blank?\n data_feed = create...
ruby
chosen
[ { "from": "system", "value": "Add Lewis Marshall to gem authors\n\nSigned-off-by: Lewis Marshall <748e1641a368164906d4a0c0e3965345453dcc93@lmars.net>\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?...
ruby
chosen
[ { "from": "system", "value": "Fix regexp to fetch intger\n\n437=23x19 now yields 437, 23, and 19. 23 was missing before.\n" }, { "from": "human", "value": "#!/usr/bin/ruby\n# Factrizes integers in followee's tweets\n# usage: ruby factorize-timeline.rb\n#\nrequire 'rubygems'\nrequire 'tw'\nrequir...
ruby
chosen
[ { "from": "system", "value": "Update chef client to 14.4.56\n" }, { "from": "human", "value": "# Add the opscode APT source for chef\ndefault[:apt][:sources] = node[:apt][:sources] | [\"opscode\"]\n\n# Set the default server version\ndefault[:chef][:server][:version] = \"12.17.33\"\n\n# Set the ...
ruby
chosen
[ { "from": "system", "value": "Add Camden to list of Phusion Github users\n" }, { "from": "human", "value": "require 'yaml'\n\nclass ConfigFileLoader\n DEFAULT_PHUSION_GITHUB_USERS = [\n 'FoobarWidget',\n 'OnixGH'\n ]\n\n def load\n if !File.exist?(config_file_path)\n abort \"Ple...
ruby
chosen
[ { "from": "system", "value": "Add line breaks to close to the original behavior\n" }, { "from": "human", "value": "module Daimon\n module Render\n class HTML < Redcarpet::Render::HTML\n def block_quote(quote)\n blockquotes = quote.each_line(\"\").map do |paragraph|\n \...
ruby
chosen
[ { "from": "system", "value": "Use ssl for member images now\n" }, { "from": "human", "value": "require 'mechanize'\n\nmodule DataLoader\n class People\n\n def self.member_to_person\n @member_to_person ||= load_people\n end\n\n # Try to load any people images that are currently mis...
ruby
chosen
[ { "from": "system", "value": "Add .pre for next release\n" }, { "from": "human", "value": "module EY\n VERSION = '3.0.1'\n ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.4.2'\nend\n" }, { "from": "gpt", "value": "module EY\n VERSION = '3.0.2.pre'\n ENG...
ruby
chosen
[ { "from": "system", "value": "Fix title method for error pages\n" }, { "from": "human", "value": "module PageFragments::FragmentsHelper\n def fragments(options={})\n root = fragment_root(options.delete(:root))\n fragments = Wheelhouse::Page.where(:parent_id => root.id).ordered.fragments\n...
ruby
chosen
[ { "from": "system", "value": "Add compcert 3.4 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": "Fix up rake builds after removing old school nuget package restore via msbuild. Now, run nuget restore before building. Also, store package locally if no NuGetDevFeed specified in an environment variable.\n" }, { "from": "human", "value": "require 'rake'\nrequire 'a...
ruby
chosen
[ { "from": "system", "value": "Add last name functionality for double the fun...ctionality\n" }, { "from": "human", "value": "puts \"Enter your name:\"\nname = gets.chomp\nputs \"Your name is #{name}!\"\nname.reverse!\nputs \"Your name backwards is #{name}\"\nname.upcase!\nputs \"Your name backwa...
ruby
chosen
[ { "from": "human", "value": "Add migration file that add title, description, visual_url, locale to entries\n" }, { "from": "gpt", "value": "class AddVisualToEntries < ActiveRecord::Migration\n def change\n add_column :entries, :title , :string\n add_column :entries, :description, :st...
ruby
chosen
[ { "from": "system", "value": "Remove mysql2 from development dependencies - not needed anymore now.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path('../lib/', __FILE__)\n$:.unshift lib unless $:.include?(lib)\n\nrequire 'adapter_extensions/version'\n\nGem::Sp...
ruby
chosen
[ { "from": "system", "value": "Change requirements for rejecting an option value\n\nBefore if either field was blank it would be rejected by the option type\nmodel. This led to a confusing behaviour where you could have one field\nfilled in and the other blank and try to update and be told it updated\nsucce...
ruby
chosen
[ { "from": "system", "value": "Set a user agent for our http clients\n" }, { "from": "human", "value": "require 'json'\nrequire 'net/http'\nrequire 'ostruct'\nrequire_relative 'core-ext/openstruct'\n\nmodule GdsApi::JsonUtils\n\n def get_json(url)\n url = URI.parse(url)\n request = url.pat...
ruby
chosen
[ { "from": "system", "value": "Set namespace by using constants\n\nthere are only 2 possible namespaces.\n" }, { "from": "human", "value": "class MiqExpression::Tag < MiqExpression::Field\n TAG_REGEX = /\n(?<model_name>([[:alnum:]]*(::)?)+)\n\\.(?<associations>([a-z_]+\\.)*)\n(?<namespace>\\bman...
ruby
chosen
[ { "from": "system", "value": "Set request path instead of using stubbing\n" }, { "from": "human", "value": "RSpec.describe Spree::StaticContentController, type: :controller do\n before do\n allow(controller).to receive(:spree_current_user).and_return(nil)\n end\n\n let!(:store) { create(:s...
ruby
chosen
[ { "from": "system", "value": "[Sass] Convert Sass::Tree::ForNode docs to YARD.\n" }, { "from": "human", "value": "require 'sass/tree/node'\n\nmodule Sass::Tree\n class ForNode < Node\n def initialize(var, from, to, exclusive, options)\n @var = var\n @from = from\n @to = to\n ...
ruby
chosen
[ { "from": "system", "value": "Abort if form isn't set\n" }, { "from": "human", "value": "module Skr\n module Print\n class Template\n\n class Definition\n def initialize(path)\n @path = path\n end\n def name\n ...
ruby
chosen
[ { "from": "system", "value": "Fix for rails mass-assignment protection\n\nIn rails 3.2.8, mass assignment can mean that the ActiveModel class\ndoesn't support mass assignment. This change ignores any such\nprotection and assumes it's your own data and you know what you're\ndoing with it.\n" }, { "fr...
ruby
chosen
[ { "from": "system", "value": "Add a newline to prevent run-on comment + command lines" }, { "from": "human", "value": "require 'fileutils'\n\nnamespace :taskmaster do\n desc \"Preview the crontab for your defined jobs\"\n task :preview do\n output = Taskmaster.cron_output\n puts output\n...
ruby
chosen
[ { "from": "system", "value": "Drop should style from woeid redirection tests\n" }, { "from": "human", "value": "require \"test_helper\"\n\nclass WoeidUrlParamValid < ActionDispatch::IntegrationTest\n\n it \"should redirect if woeid is not type town\" do\n get '/es/woeid/23424801/give' #woeid...
ruby
chosen
[ { "from": "human", "value": "Add tests for PublisherWalletGetter service" }, { "from": "gpt", "value": "require \"test_helper\"\nrequire \"webmock/minitest\"\n\nclass PublisherWalletGetterTest < ActiveJob::TestCase\n test \"when offline returns a wallet with fake data\" do\n prev_offline = R...
ruby
chosen
[ { "from": "human", "value": "Create initial migration sans user table.\n" }, { "from": "gpt", "value": "class InitialMigration < ActiveRecord::Migration\n def change\n create_table :links do |t|\n t.string :uri\n t.integer :upvote_count\n t.integer :downvote_count\n\n t.t...
ruby
chosen
[ { "from": "human", "value": "Add code wars (7) - find missing numbers\n" }, { "from": "gpt", "value": "# http://www.codewars.com/kata/find-missing-numbers/\n# --- iteration 1 ---\ndef find_missing_numbers(arr)\n Range.new(*arr.minmax).to_a - arr rescue []\nend\n" } ]
ruby
chosen
[ { "from": "system", "value": "Upgrade Firefox Dev Edition to 35.0a2\n" }, { "from": "human", "value": "class FirefoxdevelopereditionJa < Cask\n version '33.0a2'\n sha256 'ea56c43a6e93789765af356ce812c64a51cb9d0da33d21bef6d4aed54428a1a7'\n\n url \"https://ftp.mozilla.org/pub/mozilla.org/firefo...
ruby
chosen
[ { "from": "system", "value": "Use REDSHIFT_DATABASE_URL env var if exits\n\nMust exists on Heroku. Just run:\nheroku config:set\nDATABASE_URL=\"redshift://<redshit_user>:<redshift_password>@<amazon_redshift_host>:5439/snowplow?sslca=config/redshift-ssl-ca-cert.pem\"\n-a <heroku_app_name>\n" }, { "fr...
ruby
chosen
[ { "from": "system", "value": "Save other fields for creating collaborators\n" }, { "from": "human", "value": "class Account::CollaboratorsController < Account::BaseController\n \n before_action :require_to_be_not_current_user!, only: [:destroy]\n\n expose(:account) do\n current_user.accoun...
ruby
chosen
[ { "from": "system", "value": "Add specs for Submission redirect\n\nSigned-off-by: Shen Yichen <be3bb257ef8d73236feaba36cd3e5ee9095e6819@gmail.com>\n" }, { "from": "human", "value": "# frozen_string_literal: true\nrequire 'rails_helper'\n\nRSpec.describe Course::Video::Submission::SubmissionsCont...
ruby
chosen
[ { "from": "human", "value": "Add test for creating anonymous blocks\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\nrequire \"rails_helper\"\n\ndescribe Ajax::AnonymousBlockController, :ajax_controller, type: :controller do\n describe \"#create\" do\n subject { post(:create, ...
ruby
chosen
[ { "from": "system", "value": "Expire the fragment cache keys instead of manually deleting the cache\n" }, { "from": "human", "value": "module CoursesHelper\n def current_courses_cache_key(user)\n multi_cache_key :current_user_current_courses, user\n end\n\n def archived_courses_cache_key(u...
ruby
chosen
[ { "from": "system", "value": "Remove duplicated code in Admin::BannersController\n" }, { "from": "human", "value": "class Admin::BannersController < Admin::BaseController\n\n has_filters %w{all with_active with_inactive}, only: :index\n\n before_action :find_banner, only: [:edit, :update, :des...
ruby
chosen
[ { "from": "system", "value": "Drop heading and code from payslip.\n" }, { "from": "human", "value": "class PayslipDocument < LetterDocument\n def salary_table(salary)\n head = [\n t_attr(:code, LineItem),\n t_attr(:title, LineItem),\n t_attr(:times, LineItem),\n t_attr(:p...
ruby
chosen
[ { "from": "system", "value": "Add .to_h to suppress deprecation warning\n" }, { "from": "human", "value": "class UserSessionsController < ApplicationController\n protect_from_forgery :except => [:create]\n layout 'main', only: [:new, :create]\n\n def index\n redirect_to root_url\n end\n\n...
ruby
chosen
[ { "from": "system", "value": "Use the right field name\n" }, { "from": "human", "value": "class Mutations::CreateTeamMember < Mutations::BaseMutation\n field :team_member, Types::TeamMemberType, null: false\n field :ticket, Types::TicketType, null: true\n field :converted_signups, [Types::Sig...
ruby
chosen
[ { "from": "system", "value": "Switch to getting cask names from Cask module\n\nOriginally the cask names were obtained by running `brew list --cask` and parsing the output. Now we're getting the cask with the `Cask::Caskroom.casks` method and stripping out the name." }, { "from": "human", "value...
ruby
chosen
[ { "from": "system", "value": "Add pg as a dependency.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'pg_examiner/version'\n\nGem::Specification.new do |spec|\n spec.name =...
ruby
chosen
[ { "from": "system", "value": "Clean this up now that it will only be run once\n\nThis seemed to be coded in a format to accommodate it being called many times.. now we will only call it once by design so clean it up." }, { "from": "human", "value": "module VagrantPlugins\n module HostsUpdater\n...
ruby
chosen
[ { "from": "human", "value": "Migrate old playlists so they sort properly on the tags field\n" }, { "from": "gpt", "value": "class AssignDefaultValueToPlaylistTags < ActiveRecord::Migration\n def change\n # Default value of [] for tags is being set by an after_initialize callback\n Playlis...
ruby
chosen
[ { "from": "system", "value": "Remove PuSH subscriptions when delivery is answered with a 4xx error\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nclass Pubsubhubbub::DeliveryWorker\n include Sidekiq::Worker\n include RoutingHelper\n\n sidekiq_options queue: 'push', retry:...
ruby
chosen
[ { "from": "system", "value": "Change how we load code: Need to extend ActiveRecord outside of initializer block. \n\nOtherwise we get exceptions when another library tries to load a class that uses filterrific. `filterrific` won't be known yet and raises an exception." }, { "from": "human", "val...
ruby
chosen
[ { "from": "system", "value": "Add homepage to show on rubygems\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'hyperfeed/version'\n\nGem::Specification.new do |gem|\n gem....
ruby
chosen