conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Add posts method that pulls and stashed the posts.\n" }, { "from": "human", "value": "require \"app_net/version\"\nrequire 'rest_client'\nrequire 'json'\n\nmodule AppNet\n \nend\n" }, { "from": "gpt", "value": "require \"app_net/version\"\nrequire 'rest...
ruby
chosen
[ { "from": "system", "value": "Reset color to normal for each loop, ensuring clean formatting.\n" }, { "from": "human", "value": "require \"dlister/version\"\nrequire 'dlister/dir_list'\n\nmodule Dlister\n module_function\n\n def list paths\n @paths = paths\n\n @paths.sort.each_with_index...
ruby
chosen
[ { "from": "system", "value": "Revert \"remove extraneous Hash.new call per record\"\n\nThis reverts commit 9a3142f92c567f54b3b8a5b9d1a93dd007b9bdaa.\n" }, { "from": "human", "value": "class Opticon\n attr_reader :docs, :records\n\n def initialize input\n docs = records = []\n doc = reco...
ruby
chosen
[ { "from": "system", "value": "Add pry gem for development\n" }, { "from": "human", "value": "lib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire \"nyanko/version\"\n\nGem::Specification.new do |gem|\n gem.name = \"nyanko\"\n g...
ruby
chosen
[ { "from": "system", "value": "Add password skipping for ci use" }, { "from": "human", "value": "include_recipe \"percona::package_repo\"\n\n# install packages\ncase node[\"platform_family\"]\nwhen \"debian\"\n package \"percona-server-server-5.5\" do\n action :install\n options \"--force-...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary/unused UserName plist keys.\n\nFixes #18293.\n" }, { "from": "human", "value": "require 'formula'\n\nclass Tor < Formula\n homepage 'https://www.torproject.org/'\n url 'https://www.torproject.org/dist/tor-0.2.3.25.tar.gz'\n sha1 'ef02e5b0eb44ab...
ruby
chosen
[ { "from": "system", "value": "Fix sending to multiple staff members for notice\n" }, { "from": "human", "value": "class QuestionMailer < ActionMailer::Base\n add_template_helper(ApplicationHelper)\n\n default from: ENV[\"NOTIFICATION_SENDER_EMAIL\"]\n\n def question_posted(user, question)\n ...
ruby
chosen
[ { "from": "system", "value": "Simplify discussion locked checking on comment policy" }, { "from": "human", "value": "class CommentPolicy < ApplicationPolicy\n delegate :writable?, to: :discussion_policy\n \n def index?\n true\n end\n \n def show?\n discussion_policy.show?\n end\n \...
ruby
chosen
[ { "from": "system", "value": "Make pg gem a development dependency\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"locker/version\"\n\nGem::Specification.new do |s|\n s.name = \"locker\"\n s.version = Locker::VE...
ruby
chosen
[ { "from": "system", "value": "Add Chris Scoville as an author" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"TSHAlphaVideos\"\n s.version = \"1.0.0\"\n s.summary = \"Play mp4 videos with alpha background on iOS\"\n s.homepage = \"http...
ruby
chosen
[ { "from": "system", "value": "Remove rubygems version requirement. Shouldn't really matter at all. Might as well be more liberal.\n" }, { "from": "human", "value": "# encoding: UTF-8\nrequire File.expand_path('../lib/plucky/version', __FILE__)\n\nGem::Specification.new do |s|\n s.name =...
ruby
chosen
[ { "from": "system", "value": "Change LibImobileDevice from module to class\n" }, { "from": "human", "value": "module MobileDevicePool\n module LibImobileDevice\n def list_devices\n `idevice_id --list`.split(\"\\n\")\n end\n \n def show_battery_level(udid)\n get_info('idevi...
ruby
chosen
[ { "from": "system", "value": "Fix exec to work with GEM_LOADED\n" }, { "from": "human", "value": "# This is not actually required by the actual library\n# loads the bundled environment\nrequire 'bundler/shared_helpers'\n\nif Bundler::SharedHelpers.in_bundle?\n env_file = Bundler::SharedHelpers....
ruby
chosen
[ { "from": "system", "value": "Add subcommands 'site', 'member', 'song'.\n" }, { "from": "human", "value": "require \"sexy_zone\"\nrequire \"thor\"\n\nmodule SexyZone\n class CLI < Thor\n # example for using command, and , abstract.\n desc \"red WORD\", \"red words print.\"\n\n # define...
ruby
chosen
[ { "from": "system", "value": "Update leaderboard dependency to ~> 3.8.0\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire 'leaderboard_factory/version'\n\nGem::Specification.new do |gem|\n gem.authors = [\"Matt Wilson\"]\...
ruby
chosen
[ { "from": "system", "value": "Add :new_as and :edit_as options to map.resources\n\ngit-svn-id: 25dbfe3e60db60f91e4d6e28809c1877ac74c50c@2 04ac611f-ab46-0410-9913-d8964a4b2d5a\n" }, { "from": "human", "value": "module ActionController\n module Resources\n class Resource\n attr_reader :pa...
ruby
chosen
[ { "from": "system", "value": "Make sure there's only one application layout.\n" }, { "from": "human", "value": "module Hightail\n class AppBuilder < Rails::AppBuilder\n def app\n super\n directory 'app_overrides', 'app', :force => true\n end\n\n def lib\n super\n di...
ruby
chosen
[ { "from": "system", "value": "Add an index on `host_id` and `expires_at`\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\nmodule Hotdog\n module Commands\n class Init < BaseCommand\n def run(args=[])\n execute(<<-EOS)\n CREATE TABLE IF NOT EXISTS hosts (\n ...
ruby
chosen
[ { "from": "system", "value": "Handle alternate password error format\n" }, { "from": "human", "value": "module Identity::Helpers\n module API\n def decode_error(body)\n # error might look like:\n # 1. { \"id\":..., \"message\":... } (V3)\n # 2. { \"error\":... } (V2)\n ...
ruby
chosen
[ { "from": "system", "value": "Rename new frontend static directory to beta\n" }, { "from": "human", "value": "module Rack\n class ServeReactApp\n def initialize(app, _options = {})\n @app = app\n end\n\n def call(env)\n request = Rack::Request.new(env)\n if request.path....
ruby
chosen
[ { "from": "system", "value": "Update factory due to Activity rename\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nFactoryGirl.define do\n factory :application do\n sequence(:name) {|n| \"Spec Application ##{n}\" }\n end\n\n factory :trace do\n start { Time.zone.now...
ruby
chosen
[ { "from": "human", "value": "Add tests for bounds method\n" }, { "from": "gpt", "value": "require_relative './spec_helper'\nrequire_relative '../app/models/game'\n\ndescribe 'Game' do\n\n def newBoard (size)\n Array.new(size) { Array.new(size) {Cell.new(yield)}}\n end\n\n before do\n\n ...
ruby
chosen
[ { "from": "human", "value": "Create organish model in order to create objects\n" }, { "from": "gpt", "value": "class Organism\n def initialize(options)\n @iconic_taxon = options.fetch(:iconic_taxon)\n @taxon = options.fetch(:taxon)\n end\n\n def english_name\n @taxon[:common_name][:n...
ruby
chosen
[ { "from": "system", "value": "Fix correct license naming in gemspec\n" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)\nrequire 'ooxml_parser/version'\nGem::Specification.new do |s|\n s.name = 'ooxml_parser'\n s.version = OoxmlParser::Version::STRING\n ...
ruby
chosen
[ { "from": "system", "value": "Set correct version number in .podspec file\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'UTMConversion'\n s.version = '1.1.0'\n s.swift_version = '5.0'\n s.cocoapods_version = '>= 1.4.0'\n s.summary = 'Convert between latitude/longitude a...
ruby
chosen
[ { "from": "system", "value": "Make sure that CheckS3 constant is loaded\n" }, { "from": "human", "value": "# Initialize the plugin by just calling the classes here\nCcDeville && Bot::Viber && Bot::Keep && Bot::BridgeReader && Workflow::Workflow.workflows\n" }, { "from": "gpt", "value...
ruby
chosen
[ { "from": "system", "value": "Add RSpec to project description." }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"testowl/version\"\n\nGem::Specification.new do |s|\n s.name = \"testowl\"\n s.version = Testowl::VERS...
ruby
chosen
[ { "from": "system", "value": "Implement the HTTPS request utilities tests\n" }, { "from": "human", "value": "require 'test_helper'\nrequire 'conoha/util'\n\nclass TestConohaUtil < Test::Unit::TestCase\n data(\n \"IPv4 first\" => [\"111.111.111.111\", [\"111.111.111.111\", \"1111:1111:1111:11...
ruby
chosen
[ { "from": "system", "value": "Update with context method to allow sign_in admins\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire \"support/site_session_helpers\"\n\ndef with_javascript\n Capybara.current_driver = Capybara.javascript_driver\n yield\n Capybara.reset_...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to fix the version of gem\n" }, { "from": "human", "value": "Gem::Specification.new do |spec|\n spec.name = 'rptman'\n spec.version = `git describe`.strip.split('-').first\n spec.authors = ['Peter Donald']\n spec.email ...
ruby
chosen
[ { "from": "system", "value": "Add rspec-fire as a development 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 'textrazor/version'\n\nGem::Specification.new do |spec|\n sp...
ruby
chosen
[ { "from": "system", "value": "Fix regex reported by brakeman check.\n" }, { "from": "human", "value": "class Fetcher < ActiveRecord::Base\n belongs_to :provider\n belongs_to :status\n belongs_to :transport\n belongs_to :retain\n belongs_to :deliver_period\n attr_accessible :basename, :char...
ruby
chosen
[ { "from": "system", "value": "Replace Redis calls with Postgres for conflicts\n" }, { "from": "human", "value": "class Section < ActiveRecord::Base\n belongs_to :course\n validates :name, presence: true, uniqueness: { scope: :course_id }\n validates :crn, presence: true, uniqueness: true\n ...
ruby
chosen
[ { "from": "system", "value": "Revert \"stop warnings in podspec when using MIN() macro\"\n\nThis reverts commit 925222023efc3cc128d8035e51c2187cc8defa2f.\n\nsame as last revert commit\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"Mixpanel\"\n s.version = \"2...
ruby
chosen
[ { "from": "system", "value": "Test fetching records by id\n" }, { "from": "human", "value": "$: << File.join(File.dirname(__FILE__), '../lib')\n\nrequire 'rcsw'\n\nclient = RCSW::Client::Base.new('http://seakgis03.alaska.edu/geoportal/csw')\n\n# \n# client.capabilities.operations.each do |op|\n#...
ruby
chosen
[ { "from": "system", "value": "Add multi_json as a runtime dependency for JSON file-based models\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'whisky/version'\n\nGem::Specification....
ruby
chosen
[ { "from": "system", "value": "Add some notes regarding issues with initial rake db:migrate.\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'sinatra'\ngem 'activerecord', '>=2.3'\nrequire 'activerecord'\n\nclass Source < ActiveRecord::Base; end\nclass Update < ActiveRecord::Base; ...
ruby
chosen
[ { "from": "system", "value": "Add description to clean_dummy_app task\n" }, { "from": "human", "value": "namespace :refinery do \n namespace :testing do\n desc \"Generates a dummy app for testing\"\n task :dummy_app do \n require \"refinerycms\"\n \n params = []\n ...
ruby
chosen
[ { "from": "human", "value": "Add barebones BreweryDB API Client\n\nSigned-off-by: David Celis <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@davidcel.is>\n" }, { "from": "gpt", "value": "require 'net/http'\nrequire 'cgi'\nrequire 'json'\n\nmodule Brewhouse\n class Client\n class Error < RuntimeEr...
ruby
chosen
[ { "from": "system", "value": "Streamline post and put methods\n" }, { "from": "human", "value": "require 'singleton'\nrequire 'httparty'\n\nmodule Copperegg\n class Client\n include Singleton\n\n attr_reader :api_base_uri\n\n def initialize\n @api_base_uri = 'https://api.copperegg...
ruby
chosen
[ { "from": "system", "value": "Move all caching out of the standard Engine\n" }, { "from": "human", "value": "\nmodule Cutaneous\n # Manages a set of Loaders that render templates\n class Engine\n attr_accessor :loader_class, :default_format\n\n def initialize(template_roots, lexer_class,...
ruby
chosen
[ { "from": "system", "value": "Store team object on current, team id on session\n" }, { "from": "human", "value": "require 'trinity/current'\nrequire 'trinity/policy'\n\nclass DashboardController < ApplicationController\n layout 'dashboard'\n before_action :authenticate_user!, :team_pick!\n\n ...
ruby
chosen
[ { "from": "system", "value": "Allow for billable to pass through" }, { "from": "human", "value": "class SearchDenormalizer\n DEFAULT_SCOPES = []\n ALLOWED_SCOPES = [\"recent\", \"weekly\", \"for_project\", \"billable\", \"order\"]\n\n def initialize(parameters)\n @scopes = parameters[:scop...
ruby
chosen
[ { "from": "system", "value": "Remove error phrase from response\n" }, { "from": "human", "value": "module Skynet\n module Responder\n def self.parse(response)\n case response.status\n when 404, 401, 200\n Skynet::Response.new({\n status: response.status,\n ...
ruby
chosen
[ { "from": "system", "value": "Update temporary rake task to use new badging interface for partner\n" }, { "from": "human", "value": "namespace :cookbook do\n\n # Usage: rake cookbook:enable_partnert_cookbook <cookbook_name>\n desc 'Enable the Partner Cookbook icon for a cookbook'\n task enabl...
ruby
chosen
[ { "from": "system", "value": "Update spec to version 2.1.21\n" }, { "from": "human", "value": "\nPod::Spec.new do |s|\n s.name = \"LightRoute\"\n s.version = \"2.1.20\"\n s.summary = \"LightRoute is easy transition between view controllers and support many popylar arhitectur...
ruby
chosen
[ { "from": "system", "value": "Use longer timeframe flatfile for Travis CI\n\nTravis was failing because it wasn't completing the checks before the generated\nflatfile data fell off the end of the 10min graph.\n" }, { "from": "human", "value": "require 'spec_helper'\nrequire './generate_flatfile'...
ruby
chosen
[ { "from": "system", "value": "Remove UTF-8 characters from gemspec\n" }, { "from": "human", "value": "# encoding: UTF-8\nGem::Specification.new do |s|\n s.name = \"spikor-forge\"\n s.version = '0.1.0'\n s.platform = Gem::Platform::RUBY\n s.authors = [\"Erik Dalén\"]\n s.em...
ruby
chosen
[ { "from": "human", "value": "Add jAlbum.app v13\nInitial creation of jAlbum.app\nFirst attempt at jAlbum cask\nPassed install / uninstall test\nPassed audit\nPassed style check\n\nRemoved superfluous uninstall line and removed template comment left over\n\nAdded a sha256 but iffy about it due to continuous ...
ruby
chosen
[ { "from": "system", "value": "Convert email to lower case before compare.\n" }, { "from": "human", "value": "module Shoppe\n module Kiwipay\n module OrderExtensions\n\n def create_kiwipay_payment(params)\n if kiwipay_payment_approved?(params) && kiwipay_payment_valid?(params)\n ...
ruby
chosen
[ { "from": "system", "value": "Refactor parameter resolver to maintain an instance cache per resolve run" }, { "from": "human", "value": "module StackMaster\n class ParameterResolver\n ResolverNotFound = Class.new(StandardError)\n InvalidParameter = Class.new(StandardError)\n\n def self...
ruby
chosen
[ { "from": "system", "value": "Add rake task for syncing inventory levels\n" }, { "from": "human", "value": "namespace :spree_fulfillment do\n task :refresh_fulfillments => :environment do\n Rails.application.eager_load!\n watcher = Spree::Fulfillment::Providers::Amazon::FulfillmentWatcher...
ruby
chosen
[ { "from": "system", "value": "Change version to 3.0.0 for Swift 3" }, { "from": "human", "value": "Pod::Spec.new do |spec|\n spec.name = 'Embassy'\n spec.version = '2.0.0'\n spec.summary = 'Lightweight async HTTP server in pure Swift for iOS UI Automatic testing data mocking...
ruby
chosen
[ { "from": "system", "value": "Change version to a more progmatic one:)\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'Tribute'\n s.version = '1.0'\n s.summary = 'Programmatic creation of NSAttributedString doesn't have to be a pain'\n s.homepage = 'https://github.com/zat...
ruby
chosen
[ { "from": "system", "value": "Fix postgresql adapter setup for ActionCable tests\n\n(cherry picked from commit e2093c1f678175bde7c37c848686d979427346e1)\n(cherry picked from commit d7dbe48273bd9e0adb1de5b52e3cdaeb4a65630b)\n" }, { "from": "human", "value": "require \"test_helper\"\nrequire_relat...
ruby
chosen
[ { "from": "system", "value": "Update with the original author's name.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Cosmin Radoi\"]\n gem.email = [\"\"]\n g...
ruby
chosen
[ { "from": "system", "value": "Fix race condition bug, when background and realtime workers tried to check achievements for same user at once\n" }, { "from": "human", "value": "class CheckNewAchievements\n @queue = :cron\n\n def self.perform\n User.all.each{|u| u.earn_achievements }\n end\n...
ruby
chosen
[ { "from": "system", "value": "Use AREL for Ironman results\n" }, { "from": "human", "value": "# Who has done the most events? Just counts starts/appearences in results. Not pefect -- some events\r\n# are probably over-counted.\r\nclass Ironman < Competition\r\n def friendly_name\r\n 'Ironman...
ruby
chosen
[ { "from": "system", "value": "Speed up eager loading of zip codes\n" }, { "from": "human", "value": "# This is mostly copied from the Spree Zone methods,\n# with added support for zipcode zone members\nSpree::Zone.class_eval do\n\n # Check for whether an address.zipcode is available\n def incl...
ruby
chosen
[ { "from": "system", "value": "Add locale to vanish messages\n\nExtract the locale from the edition and add to vanish message for\nthe message queue. Locales are needed by the content performance\nmanager to properly track editions.\n" }, { "from": "human", "value": "class VanishPresenter\n def ...
ruby
chosen
[ { "from": "human", "value": "Add a not null constraint for protips/slug\n" }, { "from": "gpt", "value": "class AddNotNulltoProtipsSlug < ActiveRecord::Migration\n def up\n change_column_null :protips, :slug, false\n end\n\n def down\n change_column_null :protips, :slug, true\n end\nend...
ruby
chosen
[ { "from": "system", "value": "Use STDIN.read instead of context.input.read." }, { "from": "human", "value": "require 'ruble'\n\ncommand \"Documentation for Word\" do |cmd|\n cmd.key_binding = \"CONTROL+H\"\n # if selection isn't empty, use it, otherwise use the word containing the current sele...
ruby
chosen
[ { "from": "system", "value": "Add specific pry version as gem dependency\n\nA development dependency was not the right thing here.\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'jef...
ruby
chosen
[ { "from": "system", "value": "Remove test it always fail\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass MikoshiTest < Minitest::Test\n def test_that_it_has_a_version_number\n refute_nil ::Mikoshi::VERSION\n end\n\n def test_it_does_something_useful\n assert false\n e...
ruby
chosen
[ { "from": "system", "value": "Add test for queue time calc accounting for network time\n\nThe time spent in Puma waiting for the request body, or how we sometimes\ncall it \"network time\", is not included in the queue time for our\npurposes of autoscaling here, this test helps ensure that behavior.\n" },...
ruby
chosen
[ { "from": "system", "value": "Add test for link tracking action in TrackingController\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe TrackingController do\n describe \"#open\" do\n before :each do\n delivery = FactoryGirl.create(:delivery, id: 101)\n end\n\n ...
ruby
chosen
[ { "from": "human", "value": "Add the Blog::Output::Page spec outline\n" }, { "from": "gpt", "value": "require 'bundler/setup'\nBundler.require(:default)\nrequire './lib/everything/blog/output/page'\nrequire 'fakefs/spec_helpers'\nrequire './spec/support/shared'\n\ndescribe Everything::Blog::Outp...
ruby
chosen
[ { "from": "system", "value": "Add filter for columns for pages controller\n" }, { "from": "human", "value": "module Cms\n class PagesController < ResourcesController\n end\nend\n" }, { "from": "gpt", "value": "module Cms\n class PagesController < ResourcesController\n private\n...
ruby
chosen
[ { "from": "system", "value": "Return scores as well as evidence\n" }, { "from": "human", "value": "json.array! @questions do |question|\n score = Score.find_by(question: question, response: @user_response) \n\n json.id question.id\n json.category_id question.id\n json.score do \n ...
ruby
chosen
[ { "from": "system", "value": "Use new Ettu dependency injection in FreshWhen\n" }, { "from": "human", "value": "class Ettu\n module FreshWhen\n extend ActiveSupport::Concern\n\n included do\n alias_method :old_fresh_when, :fresh_when\n\n def fresh_when(record_or_options, additio...
ruby
chosen
[ { "from": "system", "value": "Fix problem with high amounts and refactoring code of the lib\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'net/http'\nrequire 'json'\n\n\nclass MoneyConverter\n\n\tdef initialize(from_currency, to_currency, amount)\n\t\t@from_currency = from_curre...
ruby
chosen
[ { "from": "system", "value": "Fix default strategy to return enumerable response as required by rack\n" }, { "from": "human", "value": "require \"rack/honeytoken/version\"\n\nmodule Rack\n class Honeytoken\n\n def initialize(app, options = {})\n self.app = app\n self.custom_strateg...
ruby
chosen
[ { "from": "system", "value": "Create method to check if the move is valid\n" }, { "from": "human", "value": "$: << File.dirname(__FILE__)\n\nclass TictactoeBoard\n\n attr_accessor :board_arr, :turn\n attr_reader :valid_slots\n\n def initialize (board_arr = Array.new(9, \" \"), turn = \"X\")\n...
ruby
chosen
[ { "from": "system", "value": "Add validations to User model\n" }, { "from": "human", "value": "class User < ActiveRecord::Base\n has_secure_password\n has_many :questions\n has_many :answers\n has_many :votes, as: :votable\n has_many :comments, as: :commentable\nend\n" }, { "from": ...
ruby
chosen
[ { "from": "system", "value": "Simplify search and eager load associations\n" }, { "from": "human", "value": "class Api::SearchController < ApplicationController\n def show\n lines = Line.search(params[:term]).joins(:quote)\n if lines.any?\n render json: lines.map(&:quote)\n else\n...
ruby
chosen
[ { "from": "system", "value": "Use plural searches instead of searches\n" }, { "from": "human", "value": "class Api::SearchController < ApplicationController\n def show\n @search = Line.search(params[:term]).joins(:quote).includes(:character, :quote).map(&:quote)\n render json: @search\n ...
ruby
chosen
[ { "from": "system", "value": "Check slug instead of path param\n" }, { "from": "human", "value": "class FinancialsController < ProductController\n before_action :find_product!\n\n def index\n unless params[:product_id] == 'coderwall'\n redirect_to product_path(@product)\n end\n end...
ruby
chosen
[ { "from": "system", "value": "Allow sorting and filtering by assertion status\n" }, { "from": "human", "value": "class AssertionBrowseTable < DatatableBase\n private\n FILTER_COLUMN_MAP = {\n 'id' => 'assertions.id',\n 'gene_name' => 'genes.name',\n 'variant_name' => 'variants.name',\...
ruby
chosen
[ { "from": "system", "value": "Add concerns to GobiertoCommon::Department model\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire_dependency \"gobierto_people\"\n\nmodule GobiertoPeople\n class Department < ApplicationRecord\n\n include GobiertoCommon::Sluggable\n\n ...
ruby
chosen
[ { "from": "system", "value": "Add minitest gem so test run on ruby 2.2\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'breaker/version'\n\nGem::Specification.new do |spec|\n spec.na...
ruby
chosen
[ { "from": "system", "value": "Use the single mapping template to render a random mapping in the api\n" }, { "from": "human", "value": "class Api::MappingsController < Api::BaseController\n\n respond_to :json\n\n has_scope :by_tags_list, :as => :tags\n has_scope :by_old_url, :as => :old_url\n ...
ruby
chosen
[ { "from": "system", "value": "Add `includes` argument to GuaranteedFindable.find_guaranteed method.\n" }, { "from": "human", "value": "module GuaranteedFindable\n extend ActiveSupport::Concern\n\n # Requires .null_record class method on incorporating class\n\n def null_record?\n self == se...
ruby
chosen
[ { "from": "system", "value": "Fix bug display periodic payment end date\n" }, { "from": "human", "value": "class PeriodicPayment < ActiveRecord::Base\n belongs_to :identity\n validates :periodic_payment_name, presence: true\n \n def display\n result = periodic_payment_name\n if !paymen...
ruby
chosen
[ { "from": "system", "value": "Use postgres system user for postgres management\n" }, { "from": "human", "value": "database_credentials = Chef::EncryptedDataBagItem.load(:docd, :database)\n\nexecute 'create docd database user' do\n command \"psql -U postgres -c \\\"CREATE ROLE docd ENCRYPTED PAS...
ruby
chosen
[ { "from": "system", "value": "Allow admins to edit sponsors\n" }, { "from": "human", "value": "class SponsorPolicy < ApplicationPolicy\n def index?\n is_admin_or_chapter_organiser?\n end\n\n def create?\n user.has_role?(:admin) || Chapter.find_roles(:organiser, user).any?\n end\n\n de...
ruby
chosen
[ { "from": "system", "value": "Fix syntax error for current user\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_forgery with: :exce...
ruby
chosen
[ { "from": "system", "value": "Fix typo, improve error handling\n" }, { "from": "human", "value": "require 'json'\n\nclass GithubHookController < ApplicationController\n\n def index\n payload = JSON.parse(params[:payload])\n logger.debug { \"Received from Github: #{payload.inspect}\" }\n\n...
ruby
chosen
[ { "from": "system", "value": "Fix for double order creation\n\nFixes #52\n" }, { "from": "human", "value": "class Spree::UsersController < Spree::StoreController\n ssl_required\n prepend_before_filter :load_object, :only => [:show, :edit, :update]\n prepend_before_filter :authorize_actions, :...
ruby
chosen
[ { "from": "system", "value": "Test submitting a game does something\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.feature 'clicking on a tile', js: true do\n scenario 'playing through a game' do\n visit games_path\n expect(page).to have_content 'Games'\n\n click_on...
ruby
chosen
[ { "from": "system", "value": "Raise ActiveRecord::RecordNotFound if invitation is not found\n" }, { "from": "human", "value": "class InvitationsController < ApplicationController\n respond_to :html, :js\n before_filter :authenticate_user!\n \n def show\n title \"Invitation\"\n @invitat...
ruby
chosen
[ { "from": "system", "value": "Add pry and fakeredis gems on development\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'organic-sitemap/version'\n\nGem::Specification.new do |spec|\n...
ruby
chosen
[ { "from": "system", "value": "Add license to gemspec of core\n" }, { "from": "human", "value": "version = File.read(File.expand_path('../../COMABLE_VERSION', __FILE__)).strip\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do |s|\n s.name = 'comable_core'\n ...
ruby
chosen
[ { "from": "human", "value": "Test file created in class with Peter's syntax.\n" }, { "from": "gpt", "value": "require ('test/unit')\nrequire ('mocha')\nrequire ('httparty')\nrequire (json_file)\n\nclass MockExampleTest < Test::Unit::TestCase\n def test_example_mocking\n\n file_name = File.ex...
ruby
chosen
[ { "from": "human", "value": "Add spec for make command.\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndescribe Guard::CMake::MakeCommand do\n\n subject { described_class.new(path) }\n\n let(:path) { '/tmp/project1/module' }\n\n describe \"#initialize\" do\n it 'instantiates wit...
ruby
chosen
[ { "from": "human", "value": "Add spec test for interactive_run_state.rb\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\ndef make(thing); end\n\ndescribe InteractiveRunState do\n let(:activity) { FactoryGirl.create(:activity) }\n let(:interactive) { FactoryGirl.create...
ruby
chosen
[ { "from": "system", "value": "Refactor param validation for prisoner validation API\n\nAlso renamed the local variable from validation to prisoner to attempt to avoid confusion:\n\nThere are two types of validation happening here:\n\n* The validation of API parameters (which happens in the controller)\n* Th...
ruby
chosen
[ { "from": "system", "value": "Check for respond_to? :to_ary instead of being\nan Array." }, { "from": "human", "value": "module ActionController\n # Action Controller Serialization\n #\n # Overrides render :json to check if the given object implements +active_model_serializer+\n # as a metho...
ruby
chosen
[ { "from": "system", "value": "Use new mocha setup, fix deprecated warning" }, { "from": "human", "value": "require 'contest'\nrequire 'jsmin'\nrequire 'tilt'\nrequire 'stylus'\nrequire 'rack/test'\nrequire 'yaml'\nrequire 'mocha'\nrequire 'debugger'\n\nrequire File.expand_path('../app/app.rb', _...
ruby
chosen
[ { "from": "system", "value": "Convert DateTime instance to utc before converting to Time\n" }, { "from": "human", "value": "class DateTime\n # @api public\n def self.to_mongo(value)\n Time.parse(value.to_s).utc\n end\n\n # @api public\n def self.from_mongo(value)\n value.to_datetime\n...
ruby
chosen
[ { "from": "system", "value": "Add search functionality to VendorPayments\n" }, { "from": "human", "value": "module NetSuite\n module Records\n class VendorPayment\n include Support::Fields\n include Support::RecordRefs\n include Support::Records\n include Support::Actions...
ruby
chosen