conversations listlengths 2 3 | source stringclasses 1
value | stack stringclasses 1
value |
|---|---|---|
[
{
"from": "system",
"value": "Remove duplication in route_command matcher.\n"
},
{
"from": "human",
"value": "module Lita\n module RSpec\n module Matchers\n extend ::RSpec::Matchers::DSL\n\n matcher :route do |message_body|\n match do\n message = Message.new(robot, ... | ruby | chosen |
[
{
"from": "system",
"value": "Use $stdin instead of STDIN\n"
},
{
"from": "human",
"value": "require 'colored'\n\nmodule Conversable\n # rubocop:disable Rails/Output\n def alert(msg)\n puts msg.red\n end\n\n def notify(msg)\n puts msg.green\n end\n\n def ask?(msg)\n puts msg.yello... | ruby | chosen |
[
{
"from": "system",
"value": "Allow environment based default locale\n\nAllow setting a default locale per deployment instance (#27):\r\n\r\n* allow environment based default locale"
},
{
"from": "human",
"value": "class ApplicationController < ActionController::Base\n protect_from_forgery with... | ruby | chosen |
[
{
"from": "system",
"value": "Add extra newline between include and before_filter blocks\n"
},
{
"from": "human",
"value": "class ApplicationController < ActionController::Base\n protect_from_forgery\n\n include GDS::SSO::ControllerMethods\n before_filter :authenticate_user!\n before_filter ... | ruby | chosen |
[
{
"from": "system",
"value": "Add authentication to Attachment controller\n"
},
{
"from": "human",
"value": "class AttachmentsController < ApplicationController\n before_action :set_attachment, only: [:show, :destroy]\n\n # GET /attachments\n def index\n @attachments = Attachment.all\n en... | ruby | chosen |
[
{
"from": "system",
"value": "Remove flash notice after successful login\n"
},
{
"from": "human",
"value": "class UsersController < ApplicationController\n before_action :authenticate_user!, except: [:create]\n def create\n user = User.new(user_params)\n if user.save\n session[:user... | ruby | chosen |
[
{
"from": "system",
"value": "Allow an array to be passed.\n"
},
{
"from": "human",
"value": "module DsAuth\n module ApplicationHelper\n def authenticated?\n (session[:user_id] && session[:user_id].to_i > 0) && (session[:user_roles] && session[:user_roles].values.include?('authenticated... | ruby | chosen |
[
{
"from": "system",
"value": "Fix validation of the size parameter\n\nSigned-off-by: Maksim Malchuk <628dbb6f3e6f66faed1622da41383b30036b33e1@gmail.com>\n"
},
{
"from": "human",
"value": "require 'pathname'\nPuppet::Type.newtype(:dhparam) do\n desc 'A Diffie Helman parameter file'\n\n ensurabl... | ruby | chosen |
[
{
"from": "system",
"value": "Check for class in river notifications observer\n"
},
{
"from": "human",
"value": "require 'pebblebed'\nrequire 'petroglyph'\n\nrequire_relative 'models/report'\n\nclass RiverNotifications < ActiveRecord::Observer\n observe :report\n\n def self.river\n @river |... | ruby | chosen |
[
{
"from": "system",
"value": "Use schema instead of example when schema is given\n"
},
{
"from": "human",
"value": "module Rambo\n module RSpec\n class ExampleGroup\n\n TEMPLATE_PATH = File.expand_path(\"../templates/example_group_template.erb\", __FILE__)\n\n attr_reader :resource... | ruby | chosen |
[
{
"from": "system",
"value": "Add Rake for Travis CI"
},
{
"from": "human",
"value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/grab/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Andy Waite\"]\n gem.email = [\"github.aw@andywaite.com\... | ruby | chosen |
[
{
"from": "system",
"value": "Return the content length as a string\n\nAll HTTP headers must be strings. Newer versions of WEBrick/Thin choke\non the header value if it's an integer. Guessing that older versions of\nRack or Rails took care of coercing this for you.\n"
},
{
"from": "human",
"valu... | ruby | chosen |
[
{
"from": "system",
"value": "Move methods into module namespace\n\nIn order to avoid polluting global namespace\n"
},
{
"from": "human",
"value": "require 'super_awesome_print/version'\nrequire 'super_awesome_print/configuration'\nrequire 'awesome_print'\n\ndef sap(msg)\n blank_lines_top\n ap... | ruby | chosen |
[
{
"from": "system",
"value": "Update test_all to call 'test' method from test_case object\n"
},
{
"from": "human",
"value": "require 'utils/compilers'\n\nclass Question < ApplicationRecord\n include Compilers\n\n validates_presence_of :description\n\n belongs_to :exercise\n has_many :test_ca... | ruby | chosen |
[
{
"from": "human",
"value": "Solve problem creating a new constructor that only set the new value while the super set the others\n"
},
{
"from": "gpt",
"value": "class Game\n attr_accessor :name, :year, :system\n attr_reader :created_at\n\n def initialize(name, options={})\n self.name = na... | ruby | chosen |
[
{
"from": "system",
"value": "Fix task name for each plugins\n"
},
{
"from": "human",
"value": "require 'clockwork'\n\nrequire_relative 'config'\nrequire_relative 'schedule'\nrequire_relative 'plugin'\n\nmodule Clockwork\n @init_proc = Proc.new do\n schedules = Schedule.all\n\n \n Plug... | ruby | chosen |
[
{
"from": "system",
"value": "Make templates work on older Ruby versions\n\n* Remove .result_with_hash function introduced in Ruby 2.5\n"
},
{
"from": "human",
"value": "module ActiveAdmin\n module Views\n class LatlngProxy < FormtasticProxy\n def build(_, *args, &_block)\n @lang... | ruby | chosen |
[
{
"from": "system",
"value": "Stop attempting to add ipojo jars to classpath as it is too late by that time\n"
},
{
"from": "human",
"value": "module Buildr\n module Ipojo\n module ProjectExtension\n include Extension\n\n def ipojo?\n !@ipojo.nil?\n end\n\n def ipo... | ruby | chosen |
[
{
"from": "system",
"value": "Use instance_exec instead of instance_eval\n\nIn Ruby 1.9.2, instance_eval doesn't yield self anymore, resulting in \"wrong number of arguments\" error. This should make it compatible with 1.8.7 and 1.9.2\n\nReferences:\nhttp://www.ruby-forum.com/topic/213313\nhttp://www.ruby-f... | ruby | chosen |
[
{
"from": "system",
"value": "Remove some attributes from object.\n"
},
{
"from": "human",
"value": "require 'fog/core/model'\n\nmodule Fog\n module Compute\n class HP\n\n class KeyPair < Fog::Model\n\n identity :name\n\n attribute :fingerprint\n attribute :public_... | ruby | chosen |
[
{
"from": "system",
"value": "Remove unnecessary condition from query.\n"
},
{
"from": "human",
"value": "require 'ipaddr'\nrequire 'geocoder/lookups/base'\nrequire 'geocoder/results/maxmind_local'\n\nmodule Geocoder::Lookup\n class MaxmindLocal < Base\n\n def initialize\n if !configura... | ruby | chosen |
[
{
"from": "system",
"value": "Fix generating file URLs on the root site\n"
},
{
"from": "human",
"value": "module Intercode\n module Liquid\n module Tags\n class FileUrlTag < ::Liquid::Tag\n attr_reader :filename\n\n def initialize(tag_name, args, tokens)\n super\... | ruby | chosen |
[
{
"from": "system",
"value": "Add \\n to fix check list markup\n"
},
{
"from": "human",
"value": "module Lita\n module GithubPrList\n class CheckList\n attr_accessor :request, :response, :payload, :redis, :repo_name, :comment_body,\n :title, :id, :github_token, :githu... | ruby | chosen |
[
{
"from": "system",
"value": "Allow time since to be passed in if required\n\nWe provide a sensible default (24 hours ago) so that things continue to work but allow\nthe time period to be passed in so we can manually run this job in a\nconsole as necessary.\n\nFor example:\n\n SyncMailingList.new(1.week.... | ruby | chosen |
[
{
"from": "system",
"value": "Update bundler to ~> 1.10.\n"
},
{
"from": "human",
"value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'iuri/version'\n\nGem::Specification.new do |spec|\n spec.name = 'iu... | ruby | chosen |
[
{
"from": "system",
"value": "Change ResponseError to override message instead to to_s avoiding a stack error\n"
},
{
"from": "human",
"value": "module EPP\n # Error response\n class ResponseError < RuntimeError\n attr_accessor :code, :xml\n # Create new ResponseError\n def initialize... | ruby | chosen |
[
{
"from": "system",
"value": "Fix links from rubygems page\n"
},
{
"from": "human",
"value": "lib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire \"ice_cube/version\"\n\nGem::Specification.new do |s|\n s.name = \"ice_cube\"\n s.summary... | ruby | chosen |
[
{
"from": "system",
"value": "Fix config file path for web service\n"
},
{
"from": "human",
"value": "require 'service_manager'\n\nServiceManager.define_service 'image-search' do |s|\n s.host = 'localhost'\n s.port = 5858\n\n s.cwd = File.expand_path '../../../build/server', __FILE__\n confi... | ruby | chosen |
[
{
"from": "system",
"value": "Add current page and pagination window to pagination filter.\n"
},
{
"from": "human",
"value": "module Liquid\n\n module PaginationFilters\n \n def paginate(pagination_info)\n pagination_html = \"\"\n if pagination_info.is_a?(Hash) && (pagination_info... | ruby | chosen |
[
{
"from": "system",
"value": "Fix for Ruby 1.9, 2.0 with patching Array\n"
},
{
"from": "human",
"value": "module Percheron\n module CoreExtensions\n module Array\n module Extras\n def return\n result = nil\n each do |x|\n r = yield(x)\n if... | ruby | chosen |
[
{
"from": "system",
"value": "Fix syntax error in Ruby 2.6>.\n"
},
{
"from": "human",
"value": "module RBattlenet\n module Endpoints\n class Base\n SUPPORTED_FIELDS = [:itself]\n\n def self.all\n raise RBattlenet::Errors::IndexNotSupported.new unless defined?(index_path)\n ... | ruby | chosen |
[
{
"from": "system",
"value": "Set deploy directory for Mallorn"
},
{
"from": "human",
"value": "set :rails_env, ENV['RAILS_ENV'] || 'development'\nset :bundle_flags, '--quiet'\nset :bundle_without, fetch(:rails_env) == \"development\" ? \"production\" : \"development debug\"\nset :branch, ENV['S... | ruby | chosen |
[
{
"from": "system",
"value": "Use freetype v0.0.3 for bold and italic\n"
},
{
"from": "human",
"value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'text2svg/version'\n\nGem::Specification.new do |spec|\n spec.na... | ruby | chosen |
[
{
"from": "system",
"value": "Fix typo in clone directory path\n"
},
{
"from": "human",
"value": "require \"fileutils\"\nrequire \"uri\"\nmodule TiyoHw\n class Setup\n attr_accessor :url\n def initialize(url)\n @url = url\n end\n\n def sha\n matches = /\\b[0-9a-f]{5,40}\\b... | ruby | chosen |
[
{
"from": "system",
"value": "Add pause method to TV."
},
{
"from": "human",
"value": "module VieraPlay\n class TV\n def initialize(control_url)\n @soap_client = Soapy.new(\n :endpoint => control_url,\n :namespace => \"urn:schemas-upnp-org:service:AVTransport:1\",\n ... | ruby | chosen |
[
{
"from": "system",
"value": "Fix for light background peeps"
},
{
"from": "human",
"value": "module XCPretty\n module ANSI\n\n EFFECT = {\n :reset => '0',\n :bold => '1',\n :underline => '4'\n }\n\n COLORS = {\n :black => '30',\n :red ... | ruby | chosen |
[
{
"from": "system",
"value": "Fix method reference error in vagrant support\n"
},
{
"from": "human",
"value": "module EverTools\n class Storage\n def dev_names\n names = []\n if @node['ec2'] &&\n @node['ec2']['block_device_mapping_ephemeral0']\n names = ec2_dev_names\... | ruby | chosen |
[
{
"from": "system",
"value": "Fix unexpected end of string error in migration\n"
},
{
"from": "human",
"value": "class ChangeCustomFieldsInNodes < ActiveRecord::Migration\n def change\n enable_extension 'hstore'\n rename_column :nodes, :custom_field, :custom_fields\n change_column :nod... | ruby | chosen |
[
{
"from": "system",
"value": ":arrow_up: Upgrade pod version to 0.4.0\n\n"
},
{
"from": "human",
"value": "Pod::Spec.new do |s|\n s.name = \"ProcessingKit\"\n s.version = \"0.3.0\"\n s.summary = \"Visual Programming library for iOS.\"\n s.description = <<-DESC\n Processin... | ruby | chosen |
[
{
"from": "human",
"value": "Add a base external request spec\n"
},
{
"from": "gpt",
"value": "require 'spec_helper'\n\nRSpec.describe 'External request', feature: true do\n it 'queries organization repos on Github' do\n uri = URI('https://api.github.com/orgs/github/repos')\n\n response =... | ruby | chosen |
[
{
"from": "system",
"value": "Revert \"Comment out test that occasionally fails on travis\"\n\nThis reverts commit 7fb7dcb8a96b874a9889a814e8233b0d3fc0c3eb.\n"
},
{
"from": "human",
"value": "require 'spec_helper'\n\ndescribe FeedsController, :type => :request do\n include HTMLCompareHelper\n ... | ruby | chosen |
[
{
"from": "system",
"value": "Remove accidental bit of commit\n"
},
{
"from": "human",
"value": "set :stage, :local\nset :rails_env, :production\nset :branch, :http_proxy\n\nrole :app, %w{deploy@localhost}\nrole :web, %w{deploy@localhost}\nrole :db, %w{deploy@localhost}\n\nset :ssh_options, {\n... | ruby | chosen |
[
{
"from": "system",
"value": "[api] Add roles association and override for has_spree_role? method to User decorator\n"
},
{
"from": "human",
"value": "Spree.user_class.class_eval do\n def generate_api_key!\n self.api_key = SecureRandom.hex(24)\n save!\n end\n\n def clear_api_key!\n s... | ruby | chosen |
[
{
"from": "system",
"value": "Improve struct with block tests\n\nPlenty of tests hit struct's built in methods, but didn't see any that actually tested supplying a block and defining additional methods in that block\n"
},
{
"from": "human",
"value": "require File.expand_path('../../../spec_helpe... | ruby | chosen |
[
{
"from": "system",
"value": "Replace README.rdoc with .md version in gemspec file\n"
},
{
"from": "human",
"value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"managed_enum/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Spec... | ruby | chosen |
[
{
"from": "system",
"value": "Configure global Pony (email) options only once\n"
},
{
"from": "human",
"value": "module HerokuBackupOrchestrator\n class EmailErrorReporter\n def initialize\n smtp_options = {\n :address => 'smtp.sendgrid.net',\n :port => '2... | ruby | chosen |
[
{
"from": "system",
"value": "Fix issues with empty lists\n"
},
{
"from": "human",
"value": "module Kempelen\n module API\n module Responses\n class ReviewableHitsResponse < Base\n attr_accessor :number_of_results\n attr_accessor :page_number\n attr_accessor :total_... | ruby | chosen |
[
{
"from": "system",
"value": "Use splat inline and add parens for clarity\n"
},
{
"from": "human",
"value": "module RubyDig\n def dig(key, *other_keys)\n if value = self[key] rescue nil\n if other_keys.empty?\n value\n elsif value.is_a?(RubyDig)\n other_key, *rest = o... | ruby | chosen |
[
{
"from": "system",
"value": "Add deprecation warnings for backward compability\n"
},
{
"from": "human",
"value": "require \"cyrax/version\"\nrequire \"cyrax/extensions/has_resource.rb\"\nrequire \"cyrax/extensions/has_response.rb\"\nrequire \"cyrax/extensions/has_callbacks.rb\"\nrequire \"cyrax... | ruby | chosen |
[
{
"from": "system",
"value": "Use File.join to play friendly with windoze\n"
},
{
"from": "human",
"value": "require \"facets/string/pathize\"\n\nmodule Using\n unless defined?(LOAD_SCHEMES)\n LOAD_SCHEMES = [:require, :load, :autoload]\n\n class << self\n def reset_default_load_sche... | ruby | chosen |
[
{
"from": "system",
"value": "Add minimum ruby version to the gemspec\n"
},
{
"from": "human",
"value": "# Provide a simple gemspec so you can easily use your enginex\n# project in your rails apps through git.\nrequire File.join(File.dirname(__FILE__), \"lib/deprecation/version\")\nGem::Specific... | ruby | chosen |
[
{
"from": "system",
"value": "Check for controller too in AdConstraint\n"
},
{
"from": "human",
"value": "# frozen_string_literal: true\n\n#\n# Routes constraints for Ad routes\n#\nclass AdConstraint\n def matches?(request)\n params = request.path_parameters\n\n return false unless valid_... | ruby | chosen |
[
{
"from": "system",
"value": "Include YTPlayer.html to pod source target\n"
},
{
"from": "human",
"value": "Pod::Spec.new do |s|\n s.name = \"YouTubePlayer\"\n s.version = \"0.2\"\n s.summary = \"Swift library for embedding and controlling YouTube videos in your iOS applicat... | ruby | chosen |
[
{
"from": "system",
"value": "Revert \"removing duplicated code: this is already in ControllerHelpers::Auth\"\n\nThis reverts commit e3f2c08823fdb97a6a806b9a873e255889bf546f.\n"
},
{
"from": "human",
"value": "class Spree::UserSessionsController < Devise::SessionsController\n helper 'spree/base... | ruby | chosen |
[
{
"from": "system",
"value": "Put the code for generating html code for DRG Forms input field to the module.\n"
},
{
"from": "human",
"value": "#--\n# Copyright (c) 2012+ Damjan Rems\n#\n# Permission is hereby granted, free of charge, to any person obtaining\n# a copy of this software and associ... | ruby | chosen |
[
{
"from": "system",
"value": "Update cask dumper to play nice with 2.5.12"
},
{
"from": "human",
"value": "# frozen_string_literal: true\n\nmodule Bundle\n module CaskDumper\n module_function\n\n def reset!\n @casks = nil\n end\n\n def casks\n return [] unless Bundle.cask_... | ruby | chosen |
[
{
"from": "system",
"value": "Revert \"No need to muck around with request.env['rack.input'], just use params['file'] from Rack::RawUpload.\"\n\nThis reverts commit 94d8882d2314caf7622be548797648e93e3902e9.\n"
},
{
"from": "human",
"value": "ActiveAdmin.register ImageAsset do\n menu parent: 'As... | ruby | chosen |
[
{
"from": "system",
"value": "Add dependency back on chef-metal\n"
},
{
"from": "human",
"value": "$:.unshift(File.dirname(__FILE__) + '/lib')\nrequire 'chef_metal_fog/version'\n\nGem::Specification.new do |s|\n s.name = 'chef-metal-fog'\n s.version = ChefMetalFog::VERSION\n s.platform = Gem:... | ruby | chosen |
[
{
"from": "system",
"value": "Use a different file name for each operating system\n"
},
{
"from": "human",
"value": "require 'bundler/setup'\nrequire 'ffi'\n\nmodule Cdistance\n extend FFI::Library\n\n lib_file = File.expand_path('../ext/cdistance/cdistance', File.dirname(__FILE__))\n\n if FF... | ruby | chosen |
[
{
"from": "system",
"value": "Revert \"Add NOT NULL constraint\"\n\nThis reverts commit e97085fa502b82c14a2229e67d664b5a683ee78c.\n"
},
{
"from": "human",
"value": "class CreateDaimonNewsAdminPosts < ActiveRecord::Migration\n def change\n create_table :daimon_news_admin_posts do |t|\n t... | ruby | chosen |
[
{
"from": "system",
"value": "Load the autoprefixer-rails gem if present in the load path.\n"
},
{
"from": "human",
"value": "# stdlib\nrequire \"pathname\"\n\n# 3rd-party\nrequire \"sprockets\"\n\nmodule Jekyll\n module AssetsPlugin\n class Environment < Sprockets::Environment\n class ... | ruby | chosen |
[
{
"from": "system",
"value": "Fix for overeager internal whitespace stripping. Ooops!\n"
},
{
"from": "human",
"value": "module DVT\n module LGA\n module Converters\n WHITESPACE_STRIP = lambda do |field, field_info|\n field.respond_to?(:strip) ? field.strip : field\n end\n\n... | ruby | chosen |
[
{
"from": "system",
"value": "Add .pre for next release\n"
},
{
"from": "human",
"value": "module EY\n VERSION = '2.3.1'\n ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.3.2'\nend\n"
},
{
"from": "gpt",
"value": "module EY\n VERSION = '2.3.2.pre'\n ENG... | ruby | chosen |
[
{
"from": "system",
"value": "Normalize argument names in expr nodes by stripping (avoids leading/trailing spaces)\n"
},
{
"from": "human",
"value": "module EbnfArguments\n class Argument < Treetop::Runtime::SyntaxNode\n def name\n text_value\n end\n \n def optional?\n fal... | ruby | chosen |
[
{
"from": "human",
"value": "Add a Chef 12 upgrade upload ctl command.\n\nThis command will take Chef 12 ready data and upload it to a\nChef 12 server\n"
},
{
"from": "gpt",
"value": "#\n# Copyright:: Copyright (c) 2014 Chef Software, Inc.\n#\n# All Rights Reserved\n#\n\nrequire \"/opt/opscode/e... | ruby | chosen |
[
{
"from": "system",
"value": "Use a simpler error class\n"
},
{
"from": "human",
"value": "require \"eventmachine\"\nrequire \"em-http-request\"\nrequire \"logger\"\nrequire \"uuid\"\nrequire \"em-twilio/sms\"\n\n$uuid ||= UUID.new\n\nmodule EventMachine\n module Twilio\n class TwilioError <... | ruby | chosen |
[
{
"from": "system",
"value": "Remove useless private in Account\n"
},
{
"from": "human",
"value": "require 'lightspeed/base'\nrequire 'lightspeed/categories'\nrequire 'lightspeed/items'\nrequire 'lightspeed/item_matrices'\nrequire 'lightspeed/item_attribute_sets'\n\nmodule Lightspeed\n class Ac... | ruby | chosen |
[
{
"from": "system",
"value": "Add 'street_union' complex PostGIS query\n"
},
{
"from": "human",
"value": "class GISTools < ActiveRecord::Base\n def self.length_m(geom, strategy=:rgeo)\n case strategy\n when :postgis\n # Custom SQL query without Corresponding Table\n # http://sta... | ruby | chosen |
[
{
"from": "system",
"value": "Refactor State class to use new LoadFile class, and instance var instead of class var.\n"
},
{
"from": "human",
"value": "module LocationsNg\n class State\n @@all_states\n\n class << self\n def all\n load_states.map{ |s| {name: s['name'], capital:... | ruby | chosen |
[
{
"from": "system",
"value": "Define default specs to ignore in a constant instead of burying it in the code\n"
},
{
"from": "human",
"value": "module RspecMixin\n attr_accessor :spec_cmd, :spec_opts\n\n def spec_opts\n @spec_opts ||= ( File.exist?('spec/spec.opts') ? '-O spec/spec.opts' : ... | ruby | chosen |
[
{
"from": "system",
"value": "Add support for all redirect codes, not just 302s\n"
},
{
"from": "human",
"value": "module Mixpal\n module Integration\n extend ActiveSupport::Concern\n\n included do\n helper_method :mixpanel\n if Rails::VERSION::MAJOR >= 4\n after_action :... | ruby | chosen |
[
{
"from": "system",
"value": "Fix typo in Slim documentation\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\nrequire 'slim'\n\nmodule Nanoc::Filters\n\n # @since 3.2.0\n class Slim < Nanoc::Filter\n\n # Runs the content through [Slim](http://slim-lang.com/)\n # This method takes ... | ruby | chosen |
[
{
"from": "human",
"value": "Add a short-circuit and problem\n"
},
{
"from": "gpt",
"value": "# Short-Circuit And\n# Let's clean up our code to make it search within each game title and show all the results.\n# If it's an exact match, we'll show something special. Clean up the code below to shor... | ruby | chosen |
[
{
"from": "system",
"value": "Set preferences_count default to 0\n"
},
{
"from": "human",
"value": "class AddPreferencesCountToStudents < ActiveRecord::Migration\n def change\n \tadd_column :students, :preferences_count, :integer\n end\nend\n"
},
{
"from": "gpt",
"value": "class A... | ruby | chosen |
[
{
"from": "system",
"value": "Use single quotes for style, not performance\n"
},
{
"from": "human",
"value": "require \"faraday\"\nrequire \"faraday_middleware\"\nrequire \"json\"\nrequire \"hashie/mash\"\nrequire \"addressable/uri\"\nrequire 'environs'\n\nrequire \"buffer/version\"\nrequire \"b... | ruby | chosen |
[
{
"from": "system",
"value": "Fix gem on Rails >= 3.1\n"
},
{
"from": "human",
"value": "require 'role'\nrequire 'role_assignment'\nrequire 'active_support/concern'\n\nmodule RolePlay\n extend ActiveSupport::Concern\n\n module ClassMethods\n def has_roles(*roles)\n roles.flatten!\n ... | ruby | chosen |
[
{
"from": "system",
"value": "Include closed issues when syncing.\n"
},
{
"from": "human",
"value": "require_relative 'error'\nrequire 'octokit'\nrequire 'safe_yaml/load'\n\nmodule SyncIssues\n # GitHub is responsible access to GitHub's API\n class GitHub\n def initialize\n @client = O... | ruby | chosen |
[
{
"from": "system",
"value": "Add some better version constraints\n"
},
{
"from": "human",
"value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"obvious_data/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do ... | ruby | chosen |
[
{
"from": "system",
"value": "[Campaign] Fix class error (mistype error) + method\n"
},
{
"from": "human",
"value": "class Emailvision::Campaign < Emailvision::Base\n\n\tattributes(\n\t\t:name,\n\t\t:mailinglist_id,\n\t\t:message_id, \n\t\t:send_date,\n\t\t:description,\n\t\t:emaildedupflg, \n\t... | ruby | chosen |
[
{
"from": "system",
"value": "Raise an error if we can't find an explicitly enabled plugin.\n"
},
{
"from": "human",
"value": "plugins = EnterprisePluginCollection.from_glob(\"/opt/*/chef-server-plugin.rb\")\nplugins.each do |p|\n next if !p.parent_plugin.nil?\n p.enabled true if node['private... | ruby | chosen |
[
{
"from": "system",
"value": "Add a comment on the code: rollup_rule.evaluate(c).\n\nThis message implies Evaluate Rollup Conditions Subprocess.\n"
},
{
"from": "human",
"value": "require 'scorm2004/sequencing'\n\nmodule Scorm2004\n module Sequencing\n # Rollup Rule Check Subprocess [RB.1.4]... | ruby | chosen |
[
{
"from": "system",
"value": "Use validation with association name instead of foreign key\n"
},
{
"from": "human",
"value": "class Comment < ActiveRecord::Base\n attr_accessible :content\n belongs_to :commentable, polymorphic: true\n belongs_to :user\n\n validates_presence_of :user_id\nend\n... | ruby | chosen |
[
{
"from": "system",
"value": "Add Static to the source type list\n"
},
{
"from": "human",
"value": "module Zartan\n module SourceType\n extend self\n\n def all\n [\n ::Sources::DigitalOcean,\n ::Sources::Linode,\n ::Sources::Joyent\n ]\n end\n end\nend\n... | ruby | chosen |
[
{
"from": "system",
"value": "Add method in job to fetch total commit count for project\n"
},
{
"from": "human",
"value": "module GithubCommitsJob\n extend self\n\n def run\n Project.with_github_url.each do |project|\n update_user_commit_counts_for(project)\n end\n end\n\n private... | ruby | chosen |
[
{
"from": "system",
"value": "Add image attribute to Film object\n"
},
{
"from": "human",
"value": "class CreateFilms < ActiveRecord::Migration\n def change\n create_table :films do |t|\n t.string :title\n t.string :runtime\n t.string :genre\n t.integer :year\n t.str... | ruby | chosen |
[
{
"from": "system",
"value": "Adjust the spacing of the doc string\n"
},
{
"from": "human",
"value": "# Read $HOME/.dtachr for where to put sockets\n# Generate a 256 character file name if a socket isn't given\n# Everything after the optional socket name is the command\nrequire 'rubygems'\nrequi... | ruby | chosen |
[
{
"from": "system",
"value": "Add support for Windows Vista to the .NET 4.0 cookbook (best commit EVER)\n\n\nFormer-commit-id: bb135e75ffb63ed7011d9e8b9af7e2a57c62531a [formerly 03b2c0538210490e66b376845f557b8d607d9eb1] [formerly df22da0e5760f39586739f9960fcb70edb142d63 [formerly 624dd5c1a4f06bfc14c91bd1361... | ruby | chosen |
[
{
"from": "system",
"value": "Fix compiling for Liquid 4\n"
},
{
"from": "human",
"value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'liquid/c/version'\n\nGem::Specification.new do |spec|\n spec.name =... | ruby | chosen |
[
{
"from": "system",
"value": "Fix search for unrated anime.\n"
},
{
"from": "human",
"value": "class Ability\n include CanCan::Ability\n\n def initialize(user)\n # Global permissions\n can :read, Watchlist, :private => false\n\n if user.nil? or user.sfw_filter\n can :read, Story,... | ruby | chosen |
[
{
"from": "system",
"value": "Add shipping_carrier_services assosication to this gem untill this ass backwards approach to a feature can be resolved\n"
},
{
"from": "human",
"value": "class Address < ActiveRecord::Base\n validates :line_1, :city, :province, :postal_code, :country, presence: tru... | ruby | chosen |
[
{
"from": "system",
"value": "Upgrade yard and exclude a couple of files to try and get CI building rdocs again\n"
},
{
"from": "human",
"value": "def force_require(gem_name, version)\n begin\n gem gem_name, version\n rescue Gem::LoadError=> e\n puts \"Installing #{gem_name} gem v#{versi... | ruby | chosen |
[
{
"from": "system",
"value": "Remove extra spaces in DSL extension.\n"
},
{
"from": "human",
"value": "class Gn\n\n module DSL\n\n def template(constant, dest, &block)\n klass = Class.new\n klass.send(:define_method, :destination) { dest }\n klass.class_eval(&block) if block_g... | ruby | chosen |
[
{
"from": "system",
"value": "Fix podspec warning from 'pod lib lint'\n"
},
{
"from": "human",
"value": "Pod::Spec.new do |s|\n s.name = \"BNRDynamicTypeManager\"\n s.version = \"0.1.0\"\n s.summary = \"Library to help manage iOS 7's Dynamic Type\"\n\n s.description = <<-D... | ruby | chosen |
[
{
"from": "system",
"value": "Add test-unit to gemspec for ruby 2.2\n"
},
{
"from": "human",
"value": "$LOAD_PATH.unshift File.expand_path('../lib', __FILE__)\nrequire 'configurations'\n\nGem::Specification.new do |s|\n s.name = 'configurations'\n s.version = Configurati... | ruby | chosen |
[
{
"from": "system",
"value": "[minor] Fix spelling error in student controller"
},
{
"from": "human",
"value": "class StudentMemberController < ApplicationController\n\tbefore_action :authenticate_student_member!\n def index\n \t# render plain: params.inspect\n\t\t# ensure that only student me... | ruby | chosen |
[
{
"from": "human",
"value": "Add an example program. This example shows how to validate an entire\nstring and accumulate information on all validation errors.\n"
},
{
"from": "gpt",
"value": "# encoding: utf-8\n#\n# Show how to parse a full string with multiple UTF8 validation failures.\n# Accu... | ruby | chosen |
[
{
"from": "human",
"value": "Add example HTTPBin client to examples/\n"
},
{
"from": "gpt",
"value": "require 'resource_kit'\n\nclass HTTPBinResource < ResourceKit::Resource\n resources do\n default_handler(:ok) { |response| response.body }\n\n get :ip, '/ip'\n get :status, '/status/:c... | ruby | chosen |
[
{
"from": "system",
"value": "Update gemspec to new best practices.\n"
},
{
"from": "human",
"value": "# encoding: utf-8\n\n$:.unshift File.expand_path('../lib', __FILE__)\nrequire 'has_accounts/version'\n\nGem::Specification.new do |s|\n s.name = \"has_accounts\"\n s.version = Ha... | ruby | chosen |
[
{
"from": "system",
"value": "Return Content-Type header in example\n"
},
{
"from": "human",
"value": "Rails3::Application.routes.draw do\n resources :cors\n root :to => proc {|env| [200, {}, [\"Hello world\"]] }\nend\n"
},
{
"from": "gpt",
"value": "Rails3::Application.routes.draw... | ruby | chosen |
[
{
"from": "system",
"value": "Add config file\nUsing yaml to read/write config file\nCode made DRYer\n\nSigned-off-by: Aniket Pant <b1c1d8736f20db3fb6c1c66bb1455ed43909f0d8@aniketpant.com>\n"
},
{
"from": "human",
"value": "require 'mote'\nrequire 'fileutils'\n\nmodule Musket\n def self.initial... | ruby | chosen |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.