conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Allow to disable CSRF protection in individual strategies\nSome OAuth2 providers ignore 'state' parameter, and don't return it back\nto the client. CSRF protection with this parameter is impossible for such\nservices.\n" }, { "from": "human", "value": "require 'omni...
ruby
chosen
[ { "from": "system", "value": "Fix Spacing & Add Items When In Index\n\nFix the spacing and add in the items to user votes when the index page\nloads.\n" }, { "from": "human", "value": "class UserVotesController < ApplicationController\n\ndef index\n @user = current_user\n @votes = @user.us...
ruby
chosen
[ { "from": "system", "value": "Add two missing form params during school signup" }, { "from": "human", "value": "class School::ParameterSanitizer < Devise::ParameterSanitizer\n def sign_up\n default_params.permit(\n :name,\n :town_id,\n :address,\n :email,\n :password...
ruby
chosen
[ { "from": "system", "value": "Add deployment target for OSX.\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = 'FieryCrucible'\n s.version = '2.1.0'\n s.summary = 'A minimalist type safe Swift dependency injection library.'\n s.description ...
ruby
chosen
[ { "from": "system", "value": "Fix gem name in the gemspec\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"active_job/retriable/version\"\n\n# Describe your gem and declare its dependencies:\nGem::Specification.new do ...
ruby
chosen
[ { "from": "system", "value": "Add motd-tail for debian systems\n" }, { "from": "human", "value": "#\n# Cookbook Name:: motd\n# Recipe:: default\n#\n# Copyright 2013, YOUR_COMPANY_NAME\n#\n# All rights reserved - Do Not Redistribute\n#\n" }, { "from": "gpt", "value": "#\n# Cookbook Na...
ruby
chosen
[ { "from": "system", "value": "Use before_save instead of before_validation\n\n\nEnsures that update_attribute xss terminates\nfields." }, { "from": "human", "value": "require \"rails_sanitize\"\n\nmodule XssTerminate\n def self.included(base)\n base.extend(ClassMethods)\n # sets up defaul...
ruby
chosen
[ { "from": "system", "value": "Define width on Raw module\n" }, { "from": "human", "value": "require \"zebra/zpl/printable\"\n\nmodule Zebra\n module Zpl\n class Raw\n include Printable\n\n def to_zpl\n check_attributes\n \"^FW#{rotation}^FO#{x},#{y}#{data}^FS\"\n ...
ruby
chosen
[ { "from": "system", "value": "Replace fail by raise (RuboCop)\n" }, { "from": "human", "value": "module NginxCookbook\n # A generalized module to provide methods that help every other cookbook\n #\n # @since 3.0.0\n # @author Mike Fiedler <miketheman@gmail.com>\n module Helpers\n # @retu...
ruby
chosen
[ { "from": "system", "value": "Add the Rakefile to the list of gem files as wel\n" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path(\"../lib\", __FILE__)\nrequire \"rets/version.rb\"\n\nGem::Specification.new do |s|\n s.name = \"ruby-rets\"\n s.version = RETS::VERS...
ruby
chosen
[ { "from": "system", "value": "Add sort method to Dice class\n" }, { "from": "human", "value": "# Class for the 5 dice in the game\n\nclass Dice\n\n\tdef initialize()\n\t\t@five_dice = 5.times.map{ 1 + rand(5)}\n\tend\n\n\tdef roll_all()\n\t\tinitialize()\n\tend\n\n\t# Rolls a single dice\n\tdef ...
ruby
chosen
[ { "from": "system", "value": "Set play to be a binary executable\n\ngit-svn-id: 9867ed3c45c5a294c22e66a9d3216297713dba95@200 ca9fbce6-ab17-0410-af20-b66f06baff09\n" }, { "from": "human", "value": "# Include hook code here\n\nActiveRecord::Base.send(:include, ActsAsHasselhoff)" }, { "from...
ruby
chosen
[ { "from": "system", "value": "Add `irc` to exception list\n" }, { "from": "human", "value": "step '表示されている内部リンクは、すべて有効である' do\n _, internal_links = all('a').partition {|link| link[:href].start_with? 'http' }\n fragment_links = internal_links.select {|link| link[:href] =~ /#/ }\n\n # [\"#activ...
ruby
chosen
[ { "from": "system", "value": "Change to ignore flag for process wait\n" }, { "from": "human", "value": "# coding: utf-8\n\nRSpec.describe TTY::Pager::SystemPager, '.page' do\n it \"executes the pager command in a subprocess\" do\n text = \"I try all things, I achieve what I can.\\n\"\n ...
ruby
chosen
[ { "from": "system", "value": "Fix require of attributes and validators to work in Rubinius\n\nWhen loading attributes and validators json-schema loads all files under attributes and validators dirs, including the byte code cache files generated by Rubinius, with this change we only require .rb files.\n" }...
ruby
chosen
[ { "from": "system", "value": "Use push helpers to format Talker messages\r\n\r\nThis correctly shows the actual pusher when a push happens instead of\r\nwhomever committed the last commit. It will also make the message a tad\r\nmore interesting:\r\n\r\n Joe Pusher created some-branch from master (+2 new co...
ruby
chosen
[ { "from": "system", "value": "Fix the issue that caused active support to blow up.\n\nIssue discussed here:\n\nhttps://github.com/rails/rails/issues/43889\n" }, { "from": "human", "value": "require 'fat_core/version'\nrequire 'fat_core/patches'\nrequire 'active_support/core_ext/object/blank'\nre...
ruby
chosen
[ { "from": "human", "value": "Add some simple prod data download scripts.\n" }, { "from": "gpt", "value": "DUMP_PATH = \"/tmp/deployer_prod_db.dump\"\n\nnamespace :app do\n desc \"Reset development database from a production dump\"\n task :reset => [:dump_db, :download_db, :import_db, :\"db:mig...
ruby
chosen
[ { "from": "system", "value": "Include db directory in filespec.\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 # Description\n s.name = \"has_accounts\"\n s.vers...
ruby
chosen
[ { "from": "system", "value": "Update type for old Cascade Cross Overall\n" }, { "from": "human", "value": "# TODO CascadeCrossOverall\n# TODO RiderRankings\n# TODO WSBA BARR\nclass SetCorrectTypeForOldEvents < ActiveRecord::Migration\n def self.up\n Bar.find(:all, :conditions => [\"date < ?\...
ruby
chosen
[ { "from": "human", "value": "Add test for lexical variables.\n" }, { "from": "gpt", "value": "require \"ikra\"\nrequire_relative \"unit_test_template\"\n\nclass LexicalVariableTest < UnitTestCase\n def test_simple_lexical_variable_int\n var1 = 10\n\n base_array = Array.pnew(100)...
ruby
chosen
[ { "from": "system", "value": "Make sure env isn't nil even if YAML has an empty section\n" }, { "from": "human", "value": "module Crosstest\n class Skeptic\n class ScenarioDefinition < Crosstest::Core::Dash # rubocop:disable ClassLength\n required_field :name, String\n required_fie...
ruby
chosen
[ { "from": "system", "value": "Modify checksum of Valec v0.3.1\n" }, { "from": "human", "value": "class Valec < Formula\n desc \"Handle application secrets securely\"\n homepage \"https://github.com/dtan4/valec\"\n url \"https://github.com/dtan4/valec/releases/download/v0.3.1/valec-v0.3.1-darw...
ruby
chosen
[ { "from": "human", "value": "Add pod spec, version 0.0.3\n" }, { "from": "gpt", "value": "Pod::Spec.new do |s|\n\n s.name = \"ZKPulseView\"\n s.version = \"0.0.2\"\n s.summary = \"Simple iOS UIView Category to create a Pulse (Breathing light) Effect on your needs\"\n\n s.de...
ruby
chosen
[ { "from": "system", "value": "Add licence (and description) to gemspec\n" }, { "from": "human", "value": "lib = File.expand_path(\"../lib/\", __FILE__)\n$:.unshift lib unless $:.include?(lib)\n\nrequire \"htmlentities/version\"\n\nspec = Gem::Specification.new do |s|\n s.name = \"ht...
ruby
chosen
[ { "from": "system", "value": "Make all font files non-stupid\n" }, { "from": "human", "value": "NonStupidDigestAssets.whitelist = [/tinymce\\/.*/, /webfont/, /ajax-running.gif/]" }, { "from": "gpt", "value": "NonStupidDigestAssets.whitelist = [/tinymce\\/.*/, /(ttf|woff|eot|svg)$/, /...
ruby
chosen
[ { "from": "system", "value": "Change gem name to snake case format\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'Mark Version'\n s.version = '0.0.0'\n s.date = '2015-05-30'\n s.summary = 'A tool for recording the version of a ruby application.'\n s.authors = [...
ruby
chosen
[ { "from": "system", "value": "Fix typo in migratie for HHP buildings\n" }, { "from": "human", "value": "class HhpBuildings < ActiveRecord::Migration[5.2]\n\n def up\n say_with_time('Setting steel inputs for non nl datasets') do\n counter = 0\n Dataset.where(data_source: 'db').find_...
ruby
chosen
[ { "from": "system", "value": "Change languageloader to preload all known languages\n" }, { "from": "human", "value": "require_relative 'language'\n\nclass LanguageLoader\n def self.load(lang=\"en\")\n begin\n require_relative 'langs/' + lang\n Object.const_get('Language_' + lang).n...
ruby
chosen
[ { "from": "human", "value": "Add Join Together.app version 7.2.0\n\nJoin Together will create and export a single AAC or ALAC audio file from the audio data of tracks dragged from iTunes or files dragged from the Finder.\n" }, { "from": "gpt", "value": "cask :v1 => 'join-together' do\n version ...
ruby
chosen
[ { "from": "system", "value": "Remove no content logger completely\n" }, { "from": "human", "value": "module Pakyow\n module Presenter\n class Template < View\n attr_accessor :name, :doc\n\n class << self\n def load(path)\n format = Utils::String.split_at_last_dot...
ruby
chosen
[ { "from": "system", "value": "Remove unnecessary line in image helper\n" }, { "from": "human", "value": "module ImageHelper\n\n def safe_image_tag(image_url, opts={})\n return if image_url.blank?\n lazyload = opts.delete(:lazyload)\n if lazyload\n lazyloaded_image_tag(image_tag(im...
ruby
chosen
[ { "from": "system", "value": "Use new 'namespaced' methods in Forem::Ability\n" }, { "from": "human", "value": "require 'cancan'\n\nmodule Forem\n module Ability\n include CanCan::Ability\n\n def self.included(target)\n target.class_eval do\n # Alias old class's initialize so ...
ruby
chosen
[ { "from": "human", "value": "Patch the TestNG addon to ensure that test failures result in a failed build.\n" }, { "from": "gpt", "value": "raise \"Patch applied upstream \" if Buildr::VERSION.to_s > '1.5.8'\n\nclass Buildr::TestNG < TestFramework::Java\n\n def run(tests, dependencies) #:nodoc:...
ruby
chosen
[ { "from": "system", "value": "Add Identity API version 2.0\n" }, { "from": "human", "value": "module ConohaApi\n class Client\n module Identity\n SERVICE = \"identity\"\n\n def identity_version\n get \"\", no_auth: true\n end\n\n def tokens\n request_json = ...
ruby
chosen
[ { "from": "system", "value": "Change NoFreeze subclass summaries to be more clear\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule IceNine\n class Freezer\n\n # A freezer class that does not freeze anything\n class NoFreeze < self\n\n # Pass through the object without f...
ruby
chosen
[ { "from": "system", "value": "Remove reference to @path_enabled. Let's make things less efficient!" }, { "from": "human", "value": "module Pacer::Pipes\n class ExpandablePipe < RubyPipe\n def initialize\n super()\n @queue = java.util.LinkedList.new\n end\n\n def add(element, ...
ruby
chosen
[ { "from": "system", "value": "Remove instance variable assignment for Services.oidc\n\nThis has no effect. Module \"instance variables\" are assigned in any\nclass which includes the module, but this module isn't included\nanywhere.\n\nThis just caused me some confusion, as I was trying to work out if the\...
ruby
chosen
[ { "from": "system", "value": "Simplify logic using Round.success? method\n" }, { "from": "human", "value": "class Round < ActiveRecord::Base\n attr_accessible :closed, :expire_time, :max_amount, :secret_token, :url, :winning_address1, :winning_address2, :charity\n\n has_many :donations\n belo...
ruby
chosen
[ { "from": "system", "value": "Make the optimistic assumption that all escapes are 2 bytes\n" }, { "from": "human", "value": "module ReadlineNG\n class ChunkedString\n\n def initialize(str=\"\")\n @buf = str\n end\n\n def <<(str)\n @buf += str\n end\n\n def each_chunk\n ...
ruby
chosen
[ { "from": "system", "value": "Fix class-loading issue in test suite\n\nFixes:\n\n```\nFailure/Error: include Spree::Core::ControllerHelpers::Auth\n\nNameError:\n uninitialized constant Spree::Core::ControllerHelpers::Auth\n# ./lib/spree/api/controller_setup.rb:19:in `block in included'\n# ./lib/spree/api/c...
ruby
chosen
[ { "from": "human", "value": "Add a user agent parser for iTunes\n" }, { "from": "gpt", "value": "class UserAgent\n module Browsers\n # The user agent for iTunes\n # \n # Some user agents:\n # iTunes/10.6.1 (Macintosh; Intel Mac OS X 10.7.3) AppleWebKit/534.53.11\n # iTunes/12.0.1...
ruby
chosen
[ { "from": "system", "value": "Order achievement by date obtained only\n" }, { "from": "human", "value": "# frozen_string_literal: true\nmodule CourseUser::AchievementsConcern\n # Order achievements based on when each course_user obtained the achievement.\n def ordered_by_date_obtained\n ord...
ruby
chosen
[ { "from": "system", "value": "Test against a different list of generated files for Rails 3 and 4\n\nBring tests back to green in 3.2.\n" }, { "from": "human", "value": "require 'generators/generators_test_helper'\nrequire 'rails-api/generators/rails/app/app_generator'\n\nclass AppGeneratorTest <...
ruby
chosen
[ { "from": "system", "value": "Add associative law for tube\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Datapipes::Tube do\n describe 'composable' do\n let(:tube_a) do\n Class.new(Datapipes::Tube) do\n def run(data)\n data + 2\n end\n ...
ruby
chosen
[ { "from": "system", "value": "Allow optionally failing test to demo error reporting\n" }, { "from": "human", "value": "require_relative '../helper/spec_helper'\n\ndescribe 'Sauce' do\n it 'successfully loads angularjs.org once' do\n angular_page.goto\n expect_true angular_page.download_bu...
ruby
chosen
[ { "from": "system", "value": "Add specs to check the gem specification information.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"#{Github::Status} VERSION\" do\n it \"should be version 0.0.1\" do\n Github::VERSION.should == \"0.0.1\"\n end\nend" }, { "from"...
ruby
chosen
[ { "from": "system", "value": "Add ConEmu and Ethan Brown's config for it.\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n#\n# Author:: Sean Fisk <sean@seanfisk.com>\n# Copyright:: Copyright (c) 2014, Sean Fisk\n# License:: Apache License, Version 2.0\n#\n# Licensed under the Apache ...
ruby
chosen
[ { "from": "system", "value": "Add new route for orders_by_create_date_graph\n" }, { "from": "human", "value": "Rails.application.routes.draw do\n devise_for :users\n resources :categories\n resources :donations, only: [:index, :new, :create]\n\n resources :items, path: \"/inventory\" do\n ...
ruby
chosen
[ { "from": "system", "value": "Comment /signout route back in\n" }, { "from": "human", "value": "Rails.application.routes.draw do\n resources :users\n resources :conversations\n\n # match '/auth/:provider/callback', :via => [:get], :to => 'sessions#create'\n match '/auth/failure', :via => [:g...
ruby
chosen
[ { "from": "system", "value": "Allow using inline style and script in the internal controllers\n\nWe use inline style and script for the view held inside Rails like\nwelcome page and mailer preview.\nTherefore, if inline is prohibited by CSP, they will not work properly.\nI think that this is not as expected...
ruby
chosen
[ { "from": "system", "value": "Add 'oj' gem to core\n" }, { "from": "human", "value": "dir 'core_gems'\ndownload \"bundler\", \"1.10.6\"\ndownload \"json\", \"1.8.1\"\ndownload \"msgpack\", \"0.5.11\"\ndownload \"cool.io\", \"1.4.2\"\ndownload \"http_parser.rb\", \"0.6.0\"\ndownload \"yajl-ruby\"...
ruby
chosen
[ { "from": "system", "value": "Swap literals and Ruby puts with numerals and assertions\n" }, { "from": "human", "value": "require_relative 'core.rb'\nrequire_relative 'testing.rb'\nTitle[\"Tuples (2)\"]\ntuple = Cons[1][2]\nputs (Car[tuple] == 1 ? \"T\" : \"F\")\nputs (Cdr[tuple] == 2 ? \"T\" : ...
ruby
chosen
[ { "from": "system", "value": "Allow paging params outside of search params\n" }, { "from": "human", "value": "require 'active_support/concern'\n\nmodule Pageable\n extend ActiveSupport::Concern\n\n included do\n def prepare_paging\n if params[:q].present?\n @page = params[:q][:p...
ruby
chosen
[ { "from": "system", "value": "Add destroy method in hero controller.\n\n[#89850086]\n" }, { "from": "human", "value": "class HeroesController < ApplicationController\n expose(:campaign)\n expose(:heroes) { campaign.heroes }\n expose(:hero, attributes: :hero_params)\n before_action :authentic...
ruby
chosen
[ { "from": "system", "value": "Remove mobile stream server URL\n" }, { "from": "human", "value": "class ListenController < ApplicationController\n layout false\n\n def redirect\n @icy_metadata = request.env['HTTP_ICY_METADATA']\n\n if $ICECAST_SERVER\n stream_server = $ICECAST_SERVER...
ruby
chosen
[ { "from": "system", "value": "Add the google search method.\n" }, { "from": "human", "value": "class SearchController < ApplicationController\n def index\n end\nend\n" }, { "from": "gpt", "value": "class SearchController < ApplicationController\n def index\n end\n\n def google\n...
ruby
chosen
[ { "from": "system", "value": "Update Twitch login to work locally (or anywhere)\n" }, { "from": "human", "value": "class TwitchController < ApplicationController\n\n def out\n redirect_to \"https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=#{client_id}&redirect_uri=#...
ruby
chosen
[ { "from": "system", "value": "Fix flash messages specs for rails 4.1.1\n" }, { "from": "human", "value": "module FlashMessagesHelper\n def flash_messages\n content_tag :div, class: 'flash' do\n filtered_flash_messages.map do |name, message|\n concat build_flash_message(name, mess...
ruby
chosen
[ { "from": "system", "value": "Simplify including files in gemspec\n" }, { "from": "human", "value": "require File.expand_path(\"../lib/cxml/version\", __FILE__)\n\nGem::Specification.new do |s|\n s.name = \"cxml\"\n s.version = CXML::VERSION\n s.summary = \"Ruby library to work...
ruby
chosen
[ { "from": "system", "value": "Add the thread library as a requirement." }, { "from": "human", "value": "require 'rest-client'\nrequire 'json'\n\n# The Azure module serves as a namespace.\nmodule Azure\n\n # The Armrest module mostly serves as a namespace, but also contains any\n # common const...
ruby
chosen
[ { "from": "system", "value": "Update gemspec to deal with new README files\n\n\ngit-svn-id: d05f03cd96514e1016f6c27423275d989868e1f9@809 a99b2113-df67-db11-8bcc-000c76553aea\n" }, { "from": "human", "value": "require 'rubygems'\nSPEC = Gem::Specification.new do |s|\n s.name = \"yard\"\n ...
ruby
chosen
[ { "from": "system", "value": "Add Pry as a development dependency for easy debugging\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'zend/version'\n\nGem::Specification.new do |spec|...
ruby
chosen
[ { "from": "system", "value": "Allow capitalized content-type response header\n" }, { "from": "human", "value": "module Faraday\n class Response::Parse < Response::Middleware\n begin\n require 'multi_json'\n require 'multi_xml'\n rescue LoadError, NameError => error\n self.l...
ruby
chosen
[ { "from": "system", "value": "TokenClassFilter: Support for :exclud => :all.\n" }, { "from": "human", "value": "module CodeRay\nmodule Encoders\n \n load :filter\n \n class TokenClassFilter < Filter\n\n include Streamable\n register_for :token_class_filter\n\n DEFAULT_OPTIONS = {\n ...
ruby
chosen
[ { "from": "system", "value": "Correct small mistake in c25b9e3\n" }, { "from": "human", "value": "module Grunt\n class Handler < Wheaties::Handler\n include Grunt::Concerns::Commands\n include Grunt::Responses::Messages\n \n protected\n def handle_command(command)\n retu...
ruby
chosen
[ { "from": "system", "value": "Handle cases where a model table is missing\n" }, { "from": "human", "value": "require 'active_support'\nrequire 'active_support/core_ext/object/try'\nrequire \"rescue_from_duplicate/active_record/version\"\n\nmodule RescueFromDuplicate\n module ActiveRecord\n end...
ruby
chosen
[ { "from": "system", "value": "Update Podspec with version number\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"BulletinBoard\"\n s.version = \"2.0.0-beta.1\"\n s.summary = \"Generate and Display Bottom Card Interfaces for iOS\"\n s.description = <<-D...
ruby
chosen
[ { "from": "system", "value": "Clean up MacOS version method usage\n\nThe MacOS.version? family of methods (other than \"leopard?\") are poorly\ndefined and lead to confusing code. Replace them in formulae with more\nexplicit comparisons.\n\n\"MacOS.version\" is a special version object that can be compared ...
ruby
chosen
[ { "from": "system", "value": "Revert \"Upgrade to openssl 1.1\"\n\nThis reverts commit a67304414d83b06ea16cb92ca28ec0d5d0572028.\n" }, { "from": "human", "value": "# THIS IS NOW HAND MANAGED, JUST EDIT THE THING\n# .travis.yml and appveyor.yml consume this,\n# try to keep it machine-parsable.\no...
ruby
chosen
[ { "from": "system", "value": "Add description, summary and dependencies for notes\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'dropbox/archive/version'\n\nGem::Specification.new d...
ruby
chosen
[ { "from": "system", "value": "Add GitHub as homepage for 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 'uk_account_validator/version'\n\nGem::Specification.new do |spec|\n ...
ruby
chosen
[ { "from": "system", "value": "Add extra default rows for tables\n" }, { "from": "human", "value": "class DatasetFileSchemasController < ApplicationController\n\n def index\n @dataset_file_schemas = DatasetFileSchema.where(user: current_user).paginate(page: params[:page], per_page: 7).order(n...
ruby
chosen
[ { "from": "system", "value": "Add comment about header ordering\n" }, { "from": "human", "value": "#\n# Author:: Adam Jacob (<adam@opscode.com>)\n# Copyright:: Copyright (c) 2008 Opscode, Inc.\n# License:: Apache License, Version 2.0\n#\n# Licensed under the Apache License, Version 2.0 (the \"Li...
ruby
chosen
[ { "from": "system", "value": "Fix exception on first line returning EOF\n" }, { "from": "human", "value": "module Dap\nmodule Input\n\n require 'csv'\n\n #\n # CSV\n #\n class InputCSV\n\n include FileSource\n\n attr_accessor :has_header, :headers\n\n def initialize(args)\n se...
ruby
chosen
[ { "from": "system", "value": "Use a regexp to make matching the response attr names a bit easier to read.\n" }, { "from": "human", "value": "class ResponseAttrHandler < YARD::Handlers::Ruby::Legacy::Base\n handles 'response_attrs'\n namespace_only\n\n def process\n statement.tokens[1..-1]....
ruby
chosen
[ { "from": "system", "value": "Make sure we follow redirects\n" }, { "from": "human", "value": "\nmodule Fed\n module Http\n class Curb\n def self.get(url)\n Curl.get(url) do|http|\n http.headers['User-Agent'] = Fed::Http.options[:user_agent]\n end.body_str\n ...
ruby
chosen
[ { "from": "system", "value": "Convert Giraph::Schema from subclass to a delegator\n" }, { "from": "human", "value": "module Giraph\n # GraphQL::Schema wrapper allowing decleration of\n # resolver objects per op type (query or mutation)\n class Schema < GraphQL::Schema\n # Extract special a...
ruby
chosen
[ { "from": "system", "value": "Write tests for the index route of the checkins controller\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe CheckinsController do\n describe \"GET #index\" do\n context \"when a place exists\" do\n let!(:place) { FactoryGirl.create :plac...
ruby
chosen
[ { "from": "human", "value": "Convert project name integration test to RSpec\n" }, { "from": "gpt", "value": "require 'spec_helper'\nrequire './features/step_definitions/testing_dsl'\n\ndescribe \"Project name\" do\n # As a developer\n # I want to assign a name for my project\n # So that the r...
ruby
chosen
[ { "from": "system", "value": "Remove restriction on json version" }, { "from": "human", "value": "require './lib/diplomat/version'\n\nGem::Specification.new \"diplomat\", Diplomat::VERSION do |spec|\n spec.authors = [\"John Hamelink\"]\n spec.email = [\"john@johnhamelink.com\"]\n...
ruby
chosen
[ { "from": "system", "value": "Change homepage from chef server to chef secrets\n\n...where the code actually lives. =^)\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire \"veil/versio...
ruby
chosen
[ { "from": "system", "value": "Simplify spec, the 2 minutes wait is not necessary anylonger\n" }, { "from": "human", "value": "require 'spec_helper'\n\nfeature \"Authentication\", js: true do\n include UIComponentHelper\n include AuthenticationWorkflow\n include WebHelper\n\n let(:user) { cre...
ruby
chosen
[ { "from": "system", "value": "Add past_vote variable to items controller\n" }, { "from": "human", "value": "class ItemsController < ApplicationController\n\thelper_method :display_user_votes_for, :new_item_for_current_user\n\n\tdef index\n\t\t@items = Item.all.page params[:page]\n\tend\n\n\tdef ...
ruby
chosen
[ { "from": "system", "value": "Add where constraint to posts retrieval\n" }, { "from": "human", "value": "class PostsController < ApplicationController\n def index\n @posts = Post.order(\"points DESC, created_at DESC\")\n end\nend\n" }, { "from": "gpt", "value": "class PostsContr...
ruby
chosen
[ { "from": "system", "value": "Add exception reporting to broken link reporter\n\nSo that we are alerted when the rake task falls over.\n" }, { "from": "human", "value": "desc \"Generates and emails CSV reports of all public documents containing broken links.\"\ntask :generate_broken_link_reports...
ruby
chosen
[ { "from": "system", "value": "Add ETag, last modified and cache headers for teams page\n" }, { "from": "human", "value": "# Public page of all Teams\nclass TeamsController < ApplicationController\n caches_page :index\n\n def index\n if RacingAssociation.current.show_all_teams_on_public_page...
ruby
chosen
[ { "from": "system", "value": "Resolve the duplication of items to be displayed\n" }, { "from": "human", "value": "class UsersController < ApplicationController\n before_action :set_user, only: [:show]\n \n def new\n @user = User.new\n end\n \n def create\n @user = User.new(user_param...
ruby
chosen
[ { "from": "human", "value": "Add dragonfly image upload/view/removal feature test\n" }, { "from": "gpt", "value": "require 'spec_helper'\nfeature \"Dragonfly integration\", js: true do\n background do\n auth_as_admin\n end\n\n scenario \"Upload, view and remove image\" do\n visit new_ad...
ruby
chosen
[ { "from": "system", "value": "Store taxon icons in a path consistent with products\n" }, { "from": "human", "value": "Spree::Taxon.class_eval do\n # Indicate which filters should be used for this taxon\n def applicable_filters\n fs = []\n #fs << Spree::ProductFilters.distributor_filter i...
ruby
chosen
[ { "from": "system", "value": "Raise exception when CSRF detected\n" }, { "from": "human", "value": "require 'shreds/authentication'\n\nclass ApplicationController < ActionController::Base\n include Shreds::Auth\n protect_from_forgery\n\n rescue_from ActiveRecord::RecordNotFound, with: :feed_n...
ruby
chosen
[ { "from": "system", "value": "Fix the cancan access denied\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery\n\n rescue_from CanCan::AccessDenied do |exception|\n redirect_to root_url, :alert => exception.message\n end\nend\n" ...
ruby
chosen
[ { "from": "system", "value": "Update guest users index action" }, { "from": "human", "value": "class GuestUsersController < ApplicationController\n def index\n end\n\n def new\n end\n\n def create\n end\n\n def partial\n end\nend\n" }, { "from": "gpt", "value": "class GuestUs...
ruby
chosen
[ { "from": "system", "value": "Allow to preview unpublished post\n" }, { "from": "human", "value": "module PostDecorator\n def to_meta_description\n plain_text_body.first(140)\n end\n\n def to_og_params\n {\n locale: 'ja_JP',\n type: 'article',\n title: title,\n descr...
ruby
chosen
[ { "from": "system", "value": "Remove tree code from submissions\n" }, { "from": "human", "value": "class SubmissionsController < ApplicationController\n layout \"water\"\n before_filter :add_commit_request_path, only: [:new]\n \n def index\n end\n\n def show\n end\n\n def create\n end\n...
ruby
chosen
[ { "from": "system", "value": "Use the actual provided aspect ratio.\n" }, { "from": "human", "value": "class ContentVideoDecorator < ApplicationDecorator\n delegate_all\n\n def embed_url\n url\n end\n\n def aspect_ratio_class\n '16by9'\n end\nend\n" }, { "from": "gpt", "va...
ruby
chosen
[ { "from": "system", "value": "Fix content membership validation failing when content id is in use on another content type with the same ID.\n" }, { "from": "human", "value": "# encoding: utf-8\n#--\n# Copyright (C) 2012 Gitorious AS\n#\n# This program is free software: you can redistribute i...
ruby
chosen
[ { "from": "system", "value": "Update the SlugMigration for the tech code of practise\n\nMarking the tech code of practise as migrated will save us worrying that it needs to be migrated in the future.\n" }, { "from": "human", "value": "desc \"This is a one off task to redirect tech code of practi...
ruby
chosen
[ { "from": "system", "value": "2168: Implement broadcast SMS via Twilio\n" }, { "from": "human", "value": "require 'twilio-ruby'\n\nclass Sms::Adapters::TwilioAdapter < Sms::Adapters::Adapter\n # checks if this adapter recognizes an incoming http receive request\n def self.recognize_receive_req...
ruby
chosen
[ { "from": "system", "value": "Revert \"Adding filename mangaling for file assets\"\n\nThis reverts commit fddf5a67c445983f6bd9828d8f0ce2498536b49c.\n\nThe download routes fail to work with this strategy for mangling\n" }, { "from": "human", "value": "\nrequire 'yogo/configuration'\n\nmodule Yogo...
ruby
chosen