conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Convert input to a string if the input was an uploader\n" }, { "from": "human", "value": "module NestedDb\n module Models\n module Instance\n def self.included(base)\n base.send(:include, ::Mongoid::Document)\n base.send(:include, ::Mongoid::T...
ruby
chosen
[ { "from": "system", "value": "Fix no argument error test\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Filtration do\n\n it 'executes a code block before the specified method' do\n class Foo1\n def foo(x)\n x + 2\n end\n end\n class Test1 < Foo1\...
ruby
chosen
[ { "from": "system", "value": "Remove available spec in columns. Add specs for human name.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe TableCloth::Column do\n subject { Class.new(TableCloth::Column) }\n let(:view_context) { ActionView::Base.new }\n let(:dummy_model) { ...
ruby
chosen
[ { "from": "system", "value": "Patch shell injection vulnerability in prepare page\n\nBy escaping the URL argument, we prevent arbitrary commands from being\nable to be injected there.\n\nFixes #56\n" }, { "from": "human", "value": "require \"printer/configuration\"\nrequire \"printer/jobs/image_...
ruby
chosen
[ { "from": "system", "value": "Make prepare request a class method call\n" }, { "from": "human", "value": "module Rodzilla\n module Resource\n class Product < Base\n\n REQUIRED_FIELDS = [:name, :description, :version]\n\n def get_selectable_products\n end\n\n def get_enter...
ruby
chosen
[ { "from": "system", "value": "Refactor RootMapper to fluid interface\n" }, { "from": "human", "value": "require \"sequel_mapper/mapper_methods\"\n\nmodule SequelMapper\n class RootMapper\n include MapperMethods\n\n def initialize(relation:, mapping:, dirty_map:)\n @relation = relatio...
ruby
chosen
[ { "from": "system", "value": "Access denied specs.\nPreparing views specs.\n\ngit-svn-id: 52e2e43ce7a15623d54ec01c4d971b259c993eed@215 354c73f7-f838-4446-8ec5-bf0d774acd2b\n" }, { "from": "human", "value": "require File.dirname(__FILE__) + '/../spec_helper'\n\ndescribe ApplicationController do\n...
ruby
chosen
[ { "from": "system", "value": "Support return package version for installed packages on FreeBSD\n" }, { "from": "human", "value": "module SpecInfra\n module Command\n class FreeBSD < Base\n def check_enabled(service, level=3)\n \"service -e | grep -- #{escape(service)}\"\n en...
ruby
chosen
[ { "from": "system", "value": "Add default movement to be FORWARD\n" }, { "from": "human", "value": "require 'toy_robot_simulator/exceptions'\n\nmodule ToyRobotSimulator\n class Robot\n attr_accessor :x, :y, :facing\n\n def initialize\n @x = nil; @y = nil; @facing = nil\n self\n ...
ruby
chosen
[ { "from": "system", "value": "Fix \"couldn't parse YAML\" error ruby 1.9.2/rails 3.1" }, { "from": "human", "value": "require \"taobao_fu\"\n\nconfig_file = File.join(Rails.root, \"config\", \"taobao.yml\")\nTaobaoFu.load(config_file) if FileTest::exists?(config_file)\n" }, { "from": "gp...
ruby
chosen
[ { "from": "system", "value": "Add positive response to post\n" }, { "from": "human", "value": "require 'sinatra/base'\nrequire 'sinatra/respond_with'\n\nclass Api < Sinatra::Base\n register Sinatra::RespondWith\n\n before do\n headers 'Access-Control-Allow-Origin' => '*',\n 'Access-Con...
ruby
chosen
[ { "from": "system", "value": "Initialize @@context in super class\n" }, { "from": "human", "value": "require 'lazy_const'\n\nclass FeatureDefinitions\n extend LazyConst\n attr_reader :test_proc\n\n def self.define_feature(name, &block)\n lazy_const(name) { new(block.to_proc) }\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Add an example for a custom scalar.\n" }, { "from": "human", "value": "module GraphQL\n # The parent type for scalars, eg {GraphQL::STRING_TYPE}, {GraphQL::INT_TYPE}\n #\n class ScalarType < GraphQL::BaseType\n defined_by_config :name, :coerce, :coerce_input, ...
ruby
chosen
[ { "from": "system", "value": "Make sure default params are always used.\n" }, { "from": "human", "value": "module Fulcrum\n class Resource\n DEFAULT_PER_PAGE = 250\n\n attr_accessor :client\n\n def initialize(client)\n self.client = client\n end\n\n def resource_name\n ...
ruby
chosen
[ { "from": "system", "value": "Remove accidental comment in redirect_back change.\n" }, { "from": "human", "value": "class Like::Interaction\n def initialize(controller)\n @controller = controller\n end\n\n def create\n Like::Like.like liker, likeable\n end\n\n def destroy\n Like::L...
ruby
chosen
[ { "from": "system", "value": "Remove Bundler.require call. Makes no sense inside a gem.\n" }, { "from": "human", "value": "require 'rails'\nrequire 'active_record/railtie'\n\nBundler.require\n\napp = Class.new(Rails::Application)\napp.config.active_support.deprecation = :log\napp.load_tasks\n\nR...
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>" }, { "from": "human", "value": "module Nanite\n ...
ruby
chosen
[ { "from": "system", "value": "Move [\"POST\"] to a constant\n" }, { "from": "human", "value": "module Rack\n class MethodOverride\n HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS PATCH LINK UNLINK)\n\n METHOD_OVERRIDE_PARAM_KEY = \"_method\".freeze\n HTTP_METHOD_OVERRIDE_HEADER = \...
ruby
chosen
[ { "from": "system", "value": "Make specs pass on Ruby 1.9\n" }, { "from": "human", "value": "require \"r_fast_r_furious/version\"\nrequire \"v8\"\nrequire \"net/http\"\nrequire \"uri\"\n\nmodule RFastRFurious\n SOURCE = \"https://raw.github.com/alunny/r_fast_r_furious/master/fast.js\"\n def ch...
ruby
chosen
[ { "from": "system", "value": "Use do ... end for multiline blocks\n" }, { "from": "human", "value": "require 'uri'\nrequire 'net/http'\n\nrequire 'urban_dictionary/version'\nrequire 'urban_dictionary/word'\nrequire 'urban_dictionary/entry'\n\nmodule UrbanDictionary\n DEFINE_URL = 'http://www.ur...
ruby
chosen
[ { "from": "system", "value": "Add homepage link to gemspec" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'flamegraph/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "system", "value": "Fix undefined 'URI.escape' method in Ruby3.0.2\n\nhttps://github.com/mattheworiordan/capybara-screenshot/issues/283" }, { "from": "human", "value": "require 'capybara-screenshot/rspec/base_reporter'\nrequire 'cgi'\nrequire 'uri'\n\nmodule Capybara\n module Screensh...
ruby
chosen
[ { "from": "system", "value": "[Brightbox] Add model method for remove\n" }, { "from": "human", "value": "require 'fog/core/model'\n\nmodule Fog\n module Compute\n class Brightbox\n\n class FirewallPolicy < Fog::Model\n\n identity :id\n attribute :url\n attribute :re...
ruby
chosen
[ { "from": "system", "value": "Set filepath on ERB engine\n" }, { "from": "human", "value": "class FixerUpper\n module Engine\n class Erb\n def call(text, scope:, &block)\n scope_binding = scope.instance_eval { binding }\n\n ::ERB.new(text).result(scope_binding)\n end\...
ruby
chosen
[ { "from": "human", "value": "Add rake task to remove non-education taxon\n" }, { "from": "gpt", "value": "namespace :taxonomy do\n desc \"remove non-education taxons\"\n task remove_non_education_taxons: :environment do\n all_taxon_ids = fetch_all_taxon_ids\n education_taxon_ids = fetch_...
ruby
chosen
[ { "from": "system", "value": "Remove puts in service method, Scorer can print it\n" }, { "from": "human", "value": "require 'httpclient'\nrequire 'colored'\nmodule Scorebutt\n class HostWatcher\n attr_accessor :ip, :blocks\n def initialize(attributes)\n self.ip = attributes[:ip]\n ...
ruby
chosen
[ { "from": "human", "value": "Add rake task to adapt syncs to API changes\n\nThe rake taks will adapt existing connector synchronizations\nto work with the new API defined by #9674\n" }, { "from": "gpt", "value": "namespace :cartodb do\n namespace :connectors do\n desc 'Adapt connector synchr...
ruby
chosen
[ { "from": "system", "value": "Add a rake task to show the configured services paths\n" }, { "from": "human", "value": "# desc \"Explaining what the task does\"\n# task :webhookr do\n# # Task goes here\n# end\n" }, { "from": "gpt", "value": "namespace :webhookr do\n desc \"List the...
ruby
chosen
[ { "from": "system", "value": "Change Heroku redirect URL to their new dashboard domain\n" }, { "from": "human", "value": "require \"sinatra/base\"\nrequire \"travis/config\"\n\nmodule TravisDeployLogs\n def self.config\n @config ||= Travis::Config.load\n end\n\n class App < Sinatra::Base\n...
ruby
chosen
[ { "from": "system", "value": "Reduce collision probability with ivars\n\nSince these are in the user’s class.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Windcharger\n module Attributes\n def attributes\n (@__attributes || []).dup.freeze\n end\n\n pr...
ruby
chosen
[ { "from": "system", "value": "Add version acceptance with 2.1 by default\n" }, { "from": "human", "value": "module BeGateway\n class Checkout\n include Connection\n\n def get_token(params)\n send_request('post', '/ctp/api/checkouts', checkout: params.merge('version' => '2.1'))\n e...
ruby
chosen
[ { "from": "system", "value": "Add `brew cu help` command\n\nCloses #50\n" }, { "from": "human", "value": "require \"optparse\"\nrequire \"ostruct\"\n\nmodule Bcu\n class << self; attr_accessor :options; end\n\n def self.parse!(args)\n options = OpenStruct.new\n options.all = false\n o...
ruby
chosen
[ { "from": "system", "value": "Use class_exec when building a handler for better semantics.\n" }, { "from": "human", "value": "module Lita\n # Constructs a Lita plugin from a block.\n # @api private\n class Builder\n def initialize(namespace, &block)\n @namespace = namespace.to_s\n ...
ruby
chosen
[ { "from": "system", "value": "Handle slim and haml templates\n" }, { "from": "human", "value": "require 'rails/railtie'\nrequire 'mjml'\nrequire 'mjml/parser'\n\nmodule MJML\n # Rails plugin for MJML ruby\n class Railtie < ::Rails::Railtie\n # Template handler for Rails\n class Handler\n...
ruby
chosen
[ { "from": "system", "value": "Set the default feed for the podcast\n" }, { "from": "human", "value": "class PodcastsController < ApplicationController\n def show\n @podcast = Podcast.find(podcast_params)\n\n if @podcast.locked? && !params[:unlock]\n redirect_to @podcast.published_url...
ruby
chosen
[ { "from": "system", "value": "Fix a bug that caused a NoMethodError on nil\n" }, { "from": "human", "value": "module Feeder\n class FeedableObserver < ::ActiveRecord::Observer\n observe Feeder.config.observables\n\n def after_create(feedable)\n Feeder::Item.create! do |item|\n ...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary rubocop disable comments\n\nThis method used to be long but now it has been extracted\n" }, { "from": "human", "value": "class OptionSetPresenter\n delegate :render, to: :renderer\n\n def initialize(option_set)\n renderer_options = coerce_opt...
ruby
chosen
[ { "from": "system", "value": "ADDED: Debug mode global option -D\n" }, { "from": "human", "value": "\n\nrequire 'AWS' # amazon-ec2 gem\n\n\nmodule Rudy\n module AWS\n extend self\n \n unless defined?(Rudy::AWS::VALID_REGIONS)\n VALID_REGIONS = [:'eu-west-1', :'us-east-1'].fr...
ruby
chosen
[ { "from": "system", "value": "Load CLI a bit later\n" }, { "from": "human", "value": "require 'json'\n\nrequire 'salt/clt/version'\nrequire 'salt/clt/config'\nrequire 'salt/clt/cli'\nrequire 'salt/clt/errors'\nrequire 'salt/clt/api'\n\nmodule Salt\n module CLT\n end\nend\n" }, { "from"...
ruby
chosen
[ { "from": "system", "value": "Set x position to zero if justification is given\n" }, { "from": "human", "value": "module Zebra\n module Zpl\n module Printable\n class MissingAttributeError < StandardError\n def initialize(message)\n super(\"Can't print if #{message}\")\n...
ruby
chosen
[ { "from": "system", "value": "Add an attribute to Axis\n" }, { "from": "human", "value": "require 'plotly/castable'\n\nmodule Plotly\n class Axis\n include Castable\n\n ATTRS = %i(title range).freeze\n attr_accessor(*ATTRS)\n\n def initialize(opts)\n return unless opts.is_a?(Ha...
ruby
chosen
[ { "from": "system", "value": "Change Window's user ivar to player\n" }, { "from": "human", "value": "class Window < Gosu::Window\n\n include Poke\n\n attr_reader :current_grid, :controls\n attr_accessor :paused\n\n def initialize\n super(480, 320, false)\n self.caption = 'Poke'\n @w...
ruby
chosen
[ { "from": "system", "value": "Update gemspec with correct gem name.\n" }, { "from": "human", "value": "Gem::Specification.new do |spec|\n spec.name = 'microsoft-live-rest-client'\n spec.version = '0.1.0'\n spec.authors = ['John Drago']\n spec.email = 'jdrago.999@gmail.co...
ruby
chosen
[ { "from": "system", "value": "Update um list extension filter regex to accomodate .md\n" }, { "from": "human", "value": "require_relative '../lib/um.rb'\n\noptions = Options.parse! do |available_opts, set_opts|\n available_opts.banner = 'usage: um list [OPTIONS...]'\n\n available_opts.on(\n ...
ruby
chosen
[ { "from": "system", "value": "Add support for Status content\n" }, { "from": "human", "value": "module CXML\n class Status\n attr_accessor :code\n attr_accessor :text\n attr_accessor :xml_lang\n\n # Initialize a new Status instance\n # @params data [Hash] optional hash with attri...
ruby
chosen
[ { "from": "system", "value": "Use a scheduler for infinite threadpool\n" }, { "from": "human", "value": "require 'thread'\nrequire 'lifeguard/threadpool'\n\nmodule Lifeguard\n class InfiniteThreadpool < ::Lifeguard::Threadpool\n\n def initialize(opts = {})\n super(opts)\n @queued_j...
ruby
chosen
[ { "from": "system", "value": "Update dummy app to pass on latest ROM from master\n" }, { "from": "human", "value": "class Users < ROM::Relation[:sql]\n base_name :users\n\n def by_id(id)\n where(id: id)\n end\n\n def index\n order(:name)\n end\n\n def by_name(name)\n index.where(n...
ruby
chosen
[ { "from": "human", "value": "Add RSpec test for NextBidder\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\nRSpec.describe NextBidder do\n describe \"#call\" do\n subject(:service) { NextBidder.new(game_state) }\n\n let(:game_state) { GameState.new }\n\n it \"returns East whe...
ruby
chosen
[ { "from": "human", "value": "Add Writer class to write output of renderers\n" }, { "from": "gpt", "value": "module Mako\n class Writer\n attr_reader :renderer, :destination\n\n def initialize(args)\n @renderer = args.fetch(:renderer)\n @destination = args.fetch(:destination)\n ...
ruby
chosen
[ { "from": "system", "value": "Make sure to call to_ptr.\n" }, { "from": "human", "value": "module FFI\n module PCap\n module Packet\n def self.included(base)\n base.module_eval do\n # previous packet in the payload\n attr_reader :prev\n end\n end\n\n...
ruby
chosen
[ { "from": "system", "value": "Update podspec, change version to 0.0.4\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"NSObject-SafeExpectations\"\n s.version = \"0.0.4-beta.1\"\n s.summary = \"No more crashes getting unexpected values from a NSDictionary...
ruby
chosen
[ { "from": "system", "value": "Add code example how to instantiate the ClearColor filter\n" }, { "from": "human", "value": "# frozen_string_literal: true\n#\n# Copyright 2017 Holger Just\n#\n# This software may be modified and distributed under the terms\n# of the MIT license. See the LICENSE.txt...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary negation from suspension logic.\n\nUse `unless` and flip ternary operators to avoid having to think through\ntoo much negation in conditionals; hopefully this makes the logic a bit\nclearer.\n" }, { "from": "human", "value": "module Devise\n modu...
ruby
chosen
[ { "from": "system", "value": "Allow passing headers to Ruxero model 'all' method\n" }, { "from": "human", "value": "class Ruxero::BaseModel\n\n def self.all(params = {})\n parts = [\"/api.xro/2.0/#{pluralized_name}\", build_conditions(params)]\n result = Ruxero.application.get(parts.join(...
ruby
chosen
[ { "from": "system", "value": "Insert server middleware by default\n" }, { "from": "human", "value": "require \"sidekiq/web\"\nrequire \"sidekiq/expected_failures/version\"\nrequire \"sidekiq/expected_failures/middleware\"\nrequire \"sidekiq/expected_failures/web\"\n\nmodule Sidekiq\n module Exp...
ruby
chosen
[ { "from": "system", "value": "Fix for ruby 1.8 compatiblity" }, { "from": "human", "value": "module Sinatra\n module AssetPack\n module Helpers\n def css(*args)\n show_asset_pack :css, *args\n end\n\n def js(*args)\n show_asset_pack :js, *args\n end\n\n ...
ruby
chosen
[ { "from": "system", "value": "Expand Bundler dependency version requirements\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'octokit/version'\n\nGem::Specification.new do |spec|\n s...
ruby
chosen
[ { "from": "system", "value": "Convert db seed + sample files to Ruby\n\nThis removes some confusion about what countries are in what zone members, and will prevent us from running into issues like #2547\n" }, { "from": "human", "value": "Spree::Sample.load_sample(\"orders\")\n\nfirst_order = Spr...
ruby
chosen
[ { "from": "human", "value": "Test that CORS requests are allowed\n" }, { "from": "gpt", "value": "require 'net/http'\nrequire 'spec_helper'\n\nRSpec.feature \"Cross-origin requests\", type: :request do\n let(:evaluate_json_uri) { URI.join(Capybara.app_host, '/evaluate.json') }\n\n it \"allows ...
ruby
chosen
[ { "from": "system", "value": "Add missing include statement to EJS publisher\n" }, { "from": "human", "value": "require 'govuk_template/version'\nrequire_relative '../helpers'\nrequire 'tmpdir'\nrequire 'open3'\n\nmodule Publisher\n class EJSPublisher\n GIT_REPO = \"github.com/alphagov/govuk...
ruby
chosen
[ { "from": "system", "value": "Fix problem with Faraday config" }, { "from": "human", "value": "module Jsoneur\n class Service\n\n attr_accessor :path, :default_params\n\n def initialize(name, base_url, &block)\n @name = name\n @base_url = base_url\n @faraday = Faraday....
ruby
chosen
[ { "from": "human", "value": "Add api constraints file under lib folder\n" }, { "from": "gpt", "value": "class ApiConstraints\n def initialize(options)\n @version = options[:version]\n @default = options[:default]\n end\n\n def matches?(req)\n @default || req.headers['Accept'].include...
ruby
chosen
[ { "from": "system", "value": "CHEF-3169: Include tests in gem package for distros, test.rubygems.org, etc\n" }, { "from": "human", "value": "$:.unshift File.expand_path('../lib', __FILE__)\nrequire 'mixlib/log/version'\n\nGem::Specification.new do |gem|\n gem.name = \"mixlib-log\"\n gem.versio...
ruby
chosen
[ { "from": "system", "value": "Update example descriptions in spec\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe 'ROM / Yesql' do\n include_context 'users'\n\n subject(:users) { rom.relation(:users) }\n\n let(:rom) { setup.finalize }\n let(:setup) { ROM.setup(:yesql, [u...
ruby
chosen
[ { "from": "system", "value": "Remove requires for no-longer-used classes\n" }, { "from": "human", "value": "require 'gitnesse/version'\nrequire 'gitnesse/commit_info_generator'\nrequire 'gitnesse/config'\nrequire 'gitnesse/config_loader'\nrequire 'gitnesse/dependency_checker'\nrequire 'gitnesse/...
ruby
chosen
[ { "from": "human", "value": "Add spec for GitHub gitignore\n" }, { "from": "gpt", "value": "require 'github_helper'\n\n# http://developer.github.com/v3/gitignore/\nresource :gitignore do\n extend Authorize\n authorize_with token: ENV['RSPEC_API_GITHUB_TOKEN']\n\n has_attribute :name, type: :s...
ruby
chosen
[ { "from": "system", "value": "Use block form of gsub\n" }, { "from": "human", "value": "require \"parsable/version\"\nrequire 'parsable/parser'\nrequire 'parsable/context'\nrequire 'parsable/parsed_item'\nrequire 'parsable/remote'\nrequire 'parsable/uri_helper'\n\nmodule Parsable\n\n def self.c...
ruby
chosen
[ { "from": "system", "value": "Replace local definition of todo by the one in external file\n" }, { "from": "human", "value": "# What_now definitions\n\nrequire 'ptools'\n\n# TODO this struct should know how to print itself\nTodo = Struct.new :text, :path, :line\n\nmodule WhatNow\n class << self...
ruby
chosen
[ { "from": "system", "value": "Remove country in search results for Switzerland as well.\n" }, { "from": "human", "value": "class Api::V1::GeocoderController < ApplicationController\n respond_to :json\n\n MAPZEN_HOST = 'http://search.mapzen.com'\n API_KEY = 'api_key=' + ENV['MAPZEN_API_KEY']\n...
ruby
chosen
[ { "from": "system", "value": "Add class comment to password controller\n" }, { "from": "human", "value": "class Users::PasswordsController < Devise::PasswordsController\n # GET /resource/password/new\n # def new\n # super\n # end\n\n # POST /resource/password\n # def create\n # super\...
ruby
chosen
[ { "from": "human", "value": "Use book collection AMS to render json data for collection serializer\n" }, { "from": "gpt", "value": "class BookCollectionSerializer < ActiveModel::Serializer\n attributes :id, :title, :author, :publisher, :published_date, :description, :price, :isbn, :buy_link, :i...
ruby
chosen
[ { "from": "system", "value": "Check permissions on target project in merge request create service.\n" }, { "from": "human", "value": "module MergeRequests\n class CreateService < MergeRequests::BaseService\n def execute\n filter_params\n label_params = params[:label_ids]\n mer...
ruby
chosen
[ { "from": "system", "value": "Put owner and participating people first\n" }, { "from": "human", "value": "module Projects\n class ParticipantsService < BaseService\n def execute(note_type, note_id)\n participating =\n if note_type && note_id\n participants_in(note_type, ...
ruby
chosen
[ { "from": "system", "value": "Update products/index to covert taxon permalink to id\n" }, { "from": "human", "value": "class Sprangular::ProductsController < Sprangular::BaseController\n def index\n searcher = Spree::Config.searcher_class.new(params)\n\n @products = searcher.retrieve_prod...
ruby
chosen
[ { "from": "human", "value": "Add initial spec of CocoaPods.\n" }, { "from": "gpt", "value": "Pod::Spec.new do |s|\n s.name = \"JSPatch\"\n s.version = \"0.0.1\"\n s.summary = \"JSPatch bridge Objective-C and JavaScript using the\" \\\n \" Objective-C runtim...
ruby
chosen
[ { "from": "system", "value": "refactor(core): Use better name for rename argument in DSL\n" }, { "from": "human", "value": "module DParse\n module DSL\n def alt(*ps)\n DParse::Parsers::Alt.new(*ps)\n end\n\n def char(c)\n DParse::Parsers::Char.new(c)\n end\n\n def char_...
ruby
chosen
[ { "from": "system", "value": "Update gem version to 0.1.3\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nGem::Specification.new do |spec|\n spec.name = \"no-style-please\"\n spec.version = \"0.1.2\"\n spec.authors = [\"Riccardo Graziosi\"]\n spec.ema...
ruby
chosen
[ { "from": "system", "value": "Revert neo4j request timeout setting\n" }, { "from": "human", "value": "require 'base'\nmodule Bitcoin2Graphdb\n class Migration\n\n def initialize(config)\n Graphdb.configure do |c|\n c.neo4j_server = config[:neo4j][:server]\n c.extensions = ...
ruby
chosen
[ { "from": "system", "value": "Add a new line at the end of configuration files\n" }, { "from": "human", "value": "# Create users configuration files\nbegin\n search('users-files', '*:*').each do |user|\n user.to_hash['files'].each do |file, content|\n file \"#{user}/#{file}\" do\n ...
ruby
chosen
[ { "from": "system", "value": "Create our Coopr user and group\n" }, { "from": "human", "value": "#\n# Cookbook Name:: coopr\n# Recipe:: default\n#\n# Copyright © 2013-2014 Cask Data, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except ...
ruby
chosen
[ { "from": "system", "value": "Make it a little easier to load up from irb\n" }, { "from": "human", "value": "require 'sinatra'\n\nmodule Grat\n \n def self.root_path\n File.dirname(File.dirname(__FILE__))\n end\n \n def self.lib_path\n root_path + '/lib'\n end\n \n def self.view_pa...
ruby
chosen
[ { "from": "system", "value": "Update OAuth2 version dependency to 0.9.0\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/omniauth-oauth2/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.add_dependency 'omniauth', '~> 1.0'\n gem.add_depe...
ruby
chosen
[ { "from": "system", "value": "Read JSON dump as utf-8\n" }, { "from": "human", "value": "require 'inch_ci/worker/build_json/task'\n\nmodule InchCI\n module Worker\n module BuildJSON\n def self.json(filename)\n JSONDump.new(filename)\n end\n\n class JSONDump\n att...
ruby
chosen
[ { "from": "system", "value": "Include ? and & in the replacement of the page parameter\n" }, { "from": "human", "value": "require 'leaf/view_helpers/base'\nrequire 'leaf/view_helpers/link_renderer'\nrequire 'leaf/view_helpers/list_renderer'\n\nLeaf::ViewHelpers::LinkRenderer.class_eval do\n pro...
ruby
chosen
[ { "from": "system", "value": "Remove byebug requirement from SerialResolver\n" }, { "from": "human", "value": "# frozen_string_literal: true\nrequire \"byebug\"\n\nclass Panko::SerializerResolver\n\n def self.resolve(name)\n serializer_name = \"#{name.singularize.camelize}Serializer\"\n s...
ruby
chosen
[ { "from": "system", "value": "Break SQLite for great JRuby justice." }, { "from": "human", "value": "module Populator\n module Adapters\n module Sqlite\n # Executes multiple SQL statements in one query when joined with \";\"\n def execute_batch(sql, name = nil)\n log(sql, na...
ruby
chosen
[ { "from": "system", "value": "Add hack method to Window\n" }, { "from": "human", "value": "require 'curses'\n\nmodule PPCurses\n\n class PPWindow < Curses::Window\n\n def initialize(height, width, top, left)\n super(height,width,top,left)\n\n keypad(true)\n box('|', '-')\n ...
ruby
chosen
[ { "from": "human", "value": "Add test for BundleFile's behavior in markup and write phases\n" }, { "from": "gpt", "value": "require 'support/test_case'\nrequire 'support/fixture_config'\nrequire 'jekyll/minibundle/bundle_file'\n\nmodule Jekyll::Minibundle::Test\n class BundleFileTest < TestCase...
ruby
chosen
[ { "from": "system", "value": "Use old regexp for slug\n" }, { "from": "human", "value": "class Page < Sequel::Model\n def before_create\n self.slug = self.title.gsub(/[^\\w\\s\\d]/, '').gsub(' ', '_')\n end\n\n def before_save\n self.compiled_content = Markup.to_html(self.content, self....
ruby
chosen
[ { "from": "system", "value": "Use custom view resolvers in PDF\n" }, { "from": "human", "value": "require 'render_anywhere'\n\nmodule PDF\n class Invoice\n include RenderAnywhere\n\n def initialize(order)\n @order = order\n end\n\n def generate\n write_html\n convert_...
ruby
chosen
[ { "from": "system", "value": "Use symbols without quotes where possible\n" }, { "from": "human", "value": "require 'sinatra'\n\nclass MySite < Sinatra::Base\n\n\t# Pages\n\n\tget '/' do\n\t\t@page_title = 'Home'\n\t\t@page_id = 'index'\n\t\terb :'index'\n\tend\n\n\tget '/projects' do\n\t\t@page_...
ruby
chosen
[ { "from": "system", "value": "Expand Wrapper specs to exercise default locales more\n" }, { "from": "human", "value": "require 'i18n'\nrequire 'i18n/hygiene'\n\ndescribe I18n::Hygiene::Wrapper do\n let(:wrapper) { I18n::Hygiene::Wrapper.new(keys_to_skip: []) }\n\n before do\n ::I18n.backend...
ruby
chosen
[ { "from": "system", "value": "Use imperative phrasing for examples.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe MethodProfiler::Profiler do\n let!(:profiler) { described_class.new(Petition) }\n let(:petition) { Petition.new }\n\n it \"creates wrapper methods for the o...
ruby
chosen
[ { "from": "system", "value": "Refactor lesson completion model spec file\n\nAddresses Issue 262\n\nI replaced the two FactoryGirl variables with doubles, added shoulda matchers to test the validations and associations, and removed the last test. I did not address the existing comment about testing that the ...
ruby
chosen
[ { "from": "system", "value": "Create log dir if missing\n" }, { "from": "human", "value": "root = File.expand_path(File.dirname(__FILE__))\n\ncookbook_path root + '/cookbooks'\ndata_bag_path '/etc/chef/databags'\nlog_level :debug\nlog_location '/var/log/chef/solo.log'\nverbose_logging true\n" ...
ruby
chosen
[ { "from": "system", "value": "Move to_hash to do_request method\n" }, { "from": "human", "value": "module PayLane\n class API\n def initialize(client)\n @client = client\n end\n\n def multi_sale(params)\n do_request(:multiSale, params, 'multi_sale_params')\n .to_hash[:...
ruby
chosen
[ { "from": "system", "value": "Update status of pending remote session specs\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Capybara::Session do\n context 'with remote mechanize driver' do\n before(:each) do\n Capybara.app_host = REMOTE_TEST_URL\n end\n\n afte...
ruby
chosen
[ { "from": "system", "value": "Use explicit requires to prevent indeterministic loading\n" }, { "from": "human", "value": "require 'rails/all'\n\ndirectory = File.dirname(File.absolute_path(__FILE__))\nDir.glob(\"#{directory}/reports_kit/*.rb\") { |file| require file }\nDir.glob(\"#{directory}/re...
ruby
chosen
[ { "from": "system", "value": "Support renamed module and class in Minitest 5\n" }, { "from": "human", "value": "module ResqueUnit\nend\n\nbegin\n require 'yajl'\nrescue LoadError\n require 'json'\nend\n\nrequire 'resque_unit/helpers'\nrequire 'resque_unit/resque'\nrequire 'resque_unit/errors'\...
ruby
chosen
[ { "from": "system", "value": "Add ability to inject the registry into Mapping.build\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule ROM\n\n class Mapping\n\n attr_reader :env, :registry, :model\n\n # @api public\n def self.build(env, &block)\n new(env, &block).regis...
ruby
chosen