conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Use public_hostname by default unless overridden.\n" }, { "from": "human", "value": "require 'net/ssh'\nrequire 'net/ssh/gateway'\n\nclass Aerosol::Connection\n include Dockly::Util::DSL\n include Dockly::Util::Logger::Mixin\n\n logger_prefix '[aerosol connection...
ruby
chosen
[ { "from": "system", "value": "Check that args are properly initialized before proceeding\n" }, { "from": "human", "value": "require 'chef'\nrequire 'chef/handler'\nrequire 'singleton'\nrequire 'pony'\n\nmodule ChefNotifier\n class Mailer < Chef::Handler\n\n include Singleton\n\n def setup...
ruby
chosen
[ { "from": "system", "value": "Use lowercase for gem name.\n" }, { "from": "human", "value": "$:.unshift(File.expand_path('../lib/', __FILE__))\n\nrequire 'dolphy/version'\n\nGem::Specification.new do |s|\n s.name = \"Dolphy\"\n s.version = Dolphy::VERSION\n s.date = \"2014-0...
ruby
chosen
[ { "from": "system", "value": "Update rubocop requirement from ~> 0.79.0 to ~> 0.80.0\n\nUpdates the requirements on [rubocop](https://github.com/rubocop-hq/rubocop) to permit the latest version.\n- [Release notes](https://github.com/rubocop-hq/rubocop/releases)\n- [Changelog](https://github.com/rubocop-hq/r...
ruby
chosen
[ { "from": "system", "value": "Allow a different apt-repo for dd-agent\n" }, { "from": "human", "value": "#\n# Cookbook Name:: dd-agent\n# Recipe:: default\n#\n# Copyright 2011, Datadog, Inc.\n#\n# All rights reserved - Do Not Redistribute\n#\n\n# Only support Debian & Ubuntu (RedHat et al. comin...
ruby
chosen
[ { "from": "system", "value": "Add .pre for next release\n" }, { "from": "human", "value": "module EY\n VERSION = '3.0.0'\n ENGINEYARD_SERVERSIDE_VERSION = ENV['ENGINEYARD_SERVERSIDE_VERSION'] || '2.4.2'\nend\n" }, { "from": "gpt", "value": "module EY\n VERSION = '3.0.1.pre'\n ENG...
ruby
chosen
[ { "from": "system", "value": "Add pry as 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 'envryo/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "system", "value": "Simplify general task factory (can always set an organizer now), and add an urgent_task factory." }, { "from": "human", "value": "FactoryGirl.define do\n\n factory :task do\n\n working_group\n sequence(:name) {|n| \"Task #{n}\" }\n sequence(:description) {...
ruby
chosen
[ { "from": "system", "value": "Unify calls to \"render\" in spec tests.\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe 'home/index.html.erb', :type => \"view\" do\n context \"when not logged in\" do\n\n before(:each) do\n view.stub(:user_signed_in).and_return(false)...
ruby
chosen
[ { "from": "system", "value": "Revert \"trying removing extending of empty module\"\n\nThis reverts commit aaafeb27e49d45015a8bdc01ce55d36ed0318964.\n" }, { "from": "human", "value": "# Copyright (c) 2010-2011, Diaspora Inc. This file is\n# licensed under the Affero General Public License ve...
ruby
chosen
[ { "from": "system", "value": "Change unicorn_env to pass any rails_env or rack_env values\n\nWhy:\n\nUnicorn -E flag overwrites RACK_ENV variable, making it impossible to\nset RACK_ENV without modifying unicorn_env config.\n" }, { "from": "human", "value": "require \"mina/bundler\"\nrequire \"mi...
ruby
chosen
[ { "from": "system", "value": "Improve user factory to create usernames too\n" }, { "from": "human", "value": "FactoryGirl.define do\n factory :user do\n email { Faker::Internet.email }\n password \"password\"\n password_confirmation \"password\"\n end\nend\n" }, { "from": "gpt...
ruby
chosen
[ { "from": "system", "value": "Stabilize tests - generate unique usernames\n\nSome tests are failing because Faker::Internet.user_name\ndoesn't have enough entropy in order to generate only unique\nusernames for within a full test runs which leads to failing\ntests since a user object cannot be created.\n" ...
ruby
chosen
[ { "from": "system", "value": "Modify test code for qua spec\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nrequire 'rails_helper'\n\nRSpec.describe Qua, :type => :model do\n before do\n FactoryGirl.create(:qua1)\n end\n context \"Qua.center\" do\n before do\n @q = Qua....
ruby
chosen
[ { "from": "system", "value": "Allow to set status in redirect, add alias for sinatra interop\n" }, { "from": "human", "value": "module NYNY\n class RequestScope\n attr_reader :request, :response\n\n def self.add_helper_module m\n include m\n end\n\n def initialize request\n ...
ruby
chosen
[ { "from": "system", "value": "Add conditional to prevent NoMethodError\n" }, { "from": "human", "value": "module Rambo\n module RamlModels\n class Method\n attr_reader :schema\n\n def initialize(raml_method)\n @schema = raml_method\n end\n\n def to_s\n schem...
ruby
chosen
[ { "from": "system", "value": "Disable option auto recover from close\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire 'timeout'\n\nmodule RubyRabbitmqJanus\n module Rabbit\n # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>\n #\n # Class for manage connect...
ruby
chosen
[ { "from": "system", "value": "Fix bug where are user agents were seen as humans\n\nNot sure why this is affecting some people and not others but apparently\nuser_agent_string is nil for some of them. Using self.user_agent_string\nfixes the issue.\n" }, { "from": "human", "value": "module VoightK...
ruby
chosen
[ { "from": "system", "value": "Change dev to runtime dependencies\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'gemrat/version'\n\nGem::Specification.new do |spec|\n spec.name ...
ruby
chosen
[ { "from": "system", "value": "Set database max connections to 20\n" }, { "from": "human", "value": "worker_processes Integer(ENV[\"WEB_CONCURRENCY\"] || 3)\ntimeout 15\npreload_app true\npid 'unicorn.pid'\n\nbefore_fork do |server, worker|\n Signal.trap 'TERM' do\n puts 'Unicorn master inter...
ruby
chosen
[ { "from": "system", "value": "Use more precise version restrictions on dev dependencies" }, { "from": "human", "value": "lib = File.expand_path(\"../lib/\", __FILE__)\n$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)\n\nrequire \"liquid/autoescape/version\"\n\nGem::Specification.new do |s|...
ruby
chosen
[ { "from": "human", "value": "Add unit test for ip6tables provider against version 1.3.10\n" }, { "from": "gpt", "value": "#!/usr/bin/env rspec\n\nrequire 'spec_helper'\nif Puppet.version < '3.4.0'\n require 'puppet/provider/confine/exists'\nelse\n require 'puppet/confine/exists'\nend\nprovider...
ruby
chosen
[ { "from": "system", "value": "Fix for travis ci build failing in 1.8 mode\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/unidata/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.name = \"unidata\"\n gem.version = Unidat...
ruby
chosen
[ { "from": "system", "value": "Fix typo on rackup test (ht: pleax)" }, { "from": "human", "value": "require \"isolation/abstract_unit\"\n\nmodule ApplicationTests\n class RackupTest < Test::Unit::TestCase\n include ActiveSupport::Testing::Isolation\n\n def rackup\n require \"rack\"\n ...
ruby
chosen
[ { "from": "system", "value": "Make node_types accessible as instance variables & add format.html for view\n" }, { "from": "human", "value": "class NodeTypesController < ApplicationController\n def index\n if params[:ids]\n node_types ||= NodeType.where(id: params[:ids])\n else\n ...
ruby
chosen
[ { "from": "system", "value": "Save to workspace: Add/remove items from session when boxes are checked or unchecked\n\nDebug: log session contents on every workspace request\n" }, { "from": "human", "value": "class WorkspacesController < ActionController::Base\n def show\n \n end\n \n def ...
ruby
chosen
[ { "from": "system", "value": "Update Tabor competition for 2015\n" }, { "from": "human", "value": "module Competitions\n # Mount Tabor Overall Series results\n class TaborOverall < Overall\n def self.parent_event_name\n \"Mt. Tabor Series\"\n end\n\n def category_names\n [\n...
ruby
chosen
[ { "from": "system", "value": "Add updated_at field to serializer.\n" }, { "from": "human", "value": "class AssessmentSerializer < ActiveModel::Serializer\n embed :ids, include: true\n attributes :id, :score, :notes, :published, :created_at\n has_one :submission\n has_one :assessor\nend\n" ...
ruby
chosen
[ { "from": "system", "value": "Fix 500 errors with some discussions\n" }, { "from": "human", "value": "class DiscussionSerializer < ApplicationSerializer\n include ReadraptorTrackable\n include MarkdownHelper\n\n attributes :number, :title, :url, :description_html, :comments_count\n\n def url...
ruby
chosen
[ { "from": "human", "value": "Add specs for warning for old TLS versions\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\nrequire \"spec_helper\"\nrequire \"bundler/vendored_persistent\"\n\nRSpec.describe Bundler::PersistentHTTP do\n describe \"#warn_old_tls_version_rubygems_conne...
ruby
chosen
[ { "from": "system", "value": "Update chdir to correct build path.\n" }, { "from": "human", "value": "require 'rubygems'\nGem.clear_paths\n\nrequire 'parseconfig'\n\nconfig = ParseConfig.new(\"#{ENV['BUILD_DIR']}/.gitmodules\")\n\nconfig.get_params.each do |param|\n next unless param.match(/^sub...
ruby
chosen
[ { "from": "system", "value": "Add notification service to AppContainer\n" }, { "from": "human", "value": "class AppContainer\n class << self\n def self.let(method, &block)\n define_method(method) do\n @lets ||= {}\n @lets[method] ||= instance_eval(&block)\n end\n e...
ruby
chosen
[ { "from": "human", "value": "Remove duplicates from sorted list\n" }, { "from": "gpt", "value": "# Given a sorted linked list, delete all duplicates such that each element appear only once. \n#\n\nclass Node < Struct.new(:value, :link)\nend\n\nclass List\n def initialize\n @root = nil...
ruby
chosen
[ { "from": "system", "value": "Add rake task for building Jekyll _drafts posts\n" }, { "from": "human", "value": "# Usage: rake minify\ndesc \"Minify files\"\ntask :minify do\n system \"java -jar _build/htmlcompressor.jar -r --type html --compress-js -o _site _site\"\nend # task :minify" }, ...
ruby
chosen
[ { "from": "system", "value": "[api] Return *all* the payment attributes in the order payload\n" }, { "from": "human", "value": "object @order\nextends \"spree/api/orders/order\"\n\nif lookup_context.find_all(\"spree/api/orders/#{root_object.state}\").present?\n extends \"spree/api/orders/#{root...
ruby
chosen
[ { "from": "system", "value": "Allow gift code to be passed through when signing up\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_...
ruby
chosen
[ { "from": "system", "value": "Make sure user authentication is executed first\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n include GDS::SSO::ControllerMethods\n\n protect_from_forgery\n\n before_filter :authenticate_user!\n before_filter :require_...
ruby
chosen
[ { "from": "system", "value": "Use explicit scope for auth helper. AC-159\n" }, { "from": "human", "value": "# Filters added to this controller apply to all controllers in the application.\n# Likewise, all the methods added will be available for all controllers.\n\nclass ApplicationController < A...
ruby
chosen
[ { "from": "system", "value": "Fix for Redmine version => 4.0.3\n\nRename `skip_before_filter` to `skip_before_action` because `skip_before_filter` was deprecated in Ruby on Rails 5\n" }, { "from": "human", "value": "require \"json\"\n\nclass GithubHookController < ApplicationController\n skip_b...
ruby
chosen
[ { "from": "system", "value": "Fix data format for state and normal -> Hash\n" }, { "from": "human", "value": "class Nagira < Sinatra::Base\n class HostStatusController\n include OutputTypeable\n\n def initialize(status, output: nil, hostname: nil)\n @status = status\n @output = ...
ruby
chosen
[ { "from": "system", "value": "Set up error message for invalid newsletters\n" }, { "from": "human", "value": "# Controller to handle newsletter requests\nclass NewslettersController < ApplicationController\n before_filter :authenticate_user!, only: :create\n\n def index\n end\n\n def create\...
ruby
chosen
[ { "from": "system", "value": "Return unspecified signature to 100\n\nRelated to opengovernment/product#113\n" }, { "from": "human", "value": "class DefaultSignatureThreshold\n DEFAULT_VALUES = { unspecified_person: 15,\n unaffiliated: 100,\n candidate: 15,\n federal: { upper: 500, lowe...
ruby
chosen
[ { "from": "human", "value": "Add delivery plug stub for ActionMailer\n" }, { "from": "gpt", "value": "require \"action_mailer\"\nrequire \"active_support\"\n\nmodule ActionGmailer\n\n class DeliveryError < StandardError\n end\n\n class DeliveryMethod\n\n attr_accessor :settings\n\n def ...
ruby
chosen
[ { "from": "system", "value": "Fix auto_sync bug with generic points\n" }, { "from": "human", "value": "class ApplicationRecord < ActiveRecord::Base\n self.abstract_class = true\n after_save :maybe_broadcast, on: [:create, :update]\n after_destroy :maybe_broadcast\n\n DONT_BROADCAST = [ \"...
ruby
chosen
[ { "from": "system", "value": "Use Rails.env.test? rather than Rails.env == 'test'\n" }, { "from": "human", "value": "class ApplicationRecord < ActiveRecord::Base\n self.abstract_class = true\n\n def audited_user_id\n user = ::Audited.store[:audited_user] # from as_user\n user ||= ::Audit...
ruby
chosen
[ { "from": "system", "value": "Add more tests for the appointments Model.all method\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe CQalendaRS::Query::Appointments::Model do\n\n describe \".all\" do\n \n it \"returns all appointments in an array of value objects\" do\n...
ruby
chosen
[ { "from": "human", "value": "Add file for basic math\n" }, { "from": "gpt", "value": "# Solution Below\n\n\n\n\n\n\n# RSpec Tests. They are included in this file because the local variables you are creating are not accessible across files. If we try to run these files as a separate file per norm...
ruby
chosen
[ { "from": "system", "value": "Set a more natural root url and always include author for the feed entries.\n" }, { "from": "human", "value": "atom_feed do |feed|\n feed.title(\"Latest activity for #{@tag}\")\n feed.updated(@tag.updated_at)\n\n for event in @events\n feed.entry(event) do |en...
ruby
chosen
[ { "from": "system", "value": "Set syslog logger for daemon kit workers\n" }, { "from": "human", "value": "# This is the same context as the environment.rb file, it is only\n# loaded afterwards and only in the production environment\n\n# Change the production log level to debug\n#config.log_level...
ruby
chosen
[ { "from": "system", "value": "Uninstall all versions to avoid an interactive question, especially on automated build machines.\n" }, { "from": "human", "value": "require 'rake'\r\nrequire 'rake/clean'\r\nrequire 'rubygems/package_task'\r\nrequire_relative 'version'\r\n\r\nSTDOUT.sync = true\r\nS...
ruby
chosen
[ { "from": "system", "value": "Add a helper method - delete_path\n" }, { "from": "human", "value": "require 'vim-flavor'\n\nclass FakeUserEnvironment\n def create_file virtual_path, content\n File.open(expand(virtual_path), 'w') do |f|\n f.write(content)\n end\n end\n\n def expand(v...
ruby
chosen
[ { "from": "system", "value": "Update controller test, does it work in Rails 3?\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass UpdatesControllerTest < ActionController::TestCase\n test 'redirect from first step to second step' do\n put :update, :id => :first\n assert_red...
ruby
chosen
[ { "from": "system", "value": "Set date to always be today\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name\t \t= 'hive-runner-android'\n s.version\t \t= '1.1.3'\n s.date \t \t= '2015-02-26'\n s.summary\t \t= 'Hive Runner Android'\n s.description\t\t= 'Th...
ruby
chosen
[ { "from": "system", "value": "Save token for 60 minutes\n" }, { "from": "human", "value": "require \"spree_core\"\nrequire \"spree_frontend\"\nrequire \"klarna_gateway/version\"\nrequire \"active_merchant/billing/gateways/klarna_gateway\"\nrequire \"klarna_gateway/engine\"\n\nmodule KlarnaGatewa...
ruby
chosen
[ { "from": "system", "value": "Fix ephemeral poll closed serializer\n" }, { "from": "human", "value": "class Slack::Ephemeral::PollClosedSerializer < Slack::BaseSerializer\n include Slack::Ephemeral::Message\n\n def text\n I18n.t(:\"slack.poll_closed\", title: object.title, url: slack_link_f...
ruby
chosen
[ { "from": "system", "value": "Remove N+1 query in HD Dashboard\n" }, { "from": "human", "value": "require \"collection_presenter\"\nrequire_dependency \"renalware/hd/base_controller\"\n\nmodule Renalware\n module HD\n class DashboardsController < BaseController\n before_filter :load_pat...
ruby
chosen
[ { "from": "system", "value": "Fix the specs by manipulating Bundler's settings differently\n\nIn `app/boot.rb`, we try to set Bundler's settings to \"unfreeze\"\nthe bundle for the purposes of our tests. This has been broken\nfor a little while due to a changed API in Bundler since v1.16.0,\nresulting in\n[...
ruby
chosen
[ { "from": "system", "value": "Set github repository as gem homepage.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/abfab/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Chris Hanks\"]\n gem.email = ['chris...
ruby
chosen
[ { "from": "human", "value": "Add Apimac Timer.app, last 7.0.0 version\n" }, { "from": "gpt", "value": "class ApimacTimer < Cask\n version :latest\n sha256 :no_check\n\n url 'http://www.apimac.com/download/timer.dmg'\n homepage 'http://www.apimac.com/mac/timer/'\n license :gratis\n\n app 'A...
ruby
chosen
[ { "from": "system", "value": "Add myself (Shane Emmons) to authors\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = \"money\"\n s.version = \"2.1.5\"\n s.summary = \"Money and currency exchange support library\"\n s.email = \"hongli@phusion.nl\"\n s.homepage = \"h...
ruby
chosen
[ { "from": "system", "value": "Add basic info to gemspec\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'month/version'\n\nGem::Specification.new do |gem|\n gem.name ...
ruby
chosen
[ { "from": "system", "value": "Move infinite range expectations to their own example\n" }, { "from": "human", "value": "require File.expand_path('../../../spec_helper', __FILE__)\n\nruby_version_is \"2.0\" do\n describe \"Range#size\" do\n it \"returns the number of elements in the range\" do...
ruby
chosen
[ { "from": "system", "value": "Update shoulda-context dependency to 1.1.1\n" }, { "from": "human", "value": "require File.expand_path(File.dirname(__FILE__) + '/lib/steam-condenser/version')\n\nGem::Specification.new do |s|\n s.name = 'steam-condenser'\n s.version = SteamCondenser::V...
ruby
chosen
[ { "from": "system", "value": "Adjust the gem-publisher for 2.x gems\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\ngems_we_have = Dir['*.gem']\n\nputs \"Usage: cd to dir where you unzipped the gem download, and run me there.\" if gems_we_have == []\n\ngem_map = gems_we_have.inject({ }...
ruby
chosen
[ { "from": "system", "value": "Replace 'rails' with 'railties', to not require extra gems when not needed.\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\n# Maintain your gem's version:\nrequire \"jquery_mobile_rails/version\"\n\n# Describe your gem and declar...
ruby
chosen
[ { "from": "system", "value": "Add assessment_dateto json date fields for parsing\n" }, { "from": "human", "value": "class JsonTransformer\n\n def transform(file)\n require 'json'\n parsed = JSON.parse(file, symbolize_names: true)\n parsed.each do |row|\n transform_row row\n end...
ruby
chosen
[ { "from": "system", "value": "Fix uploading doc collection files\n" }, { "from": "human", "value": "module Services\n module DocCollections\n class UploadFiles < Services::Base\n BATCH_SIZE = 100\n\n def call(doc_collection_id)\n doc_collection = DocCollection.where(id: doc_...
ruby
chosen
[ { "from": "system", "value": "Change condition for report tree\n" }, { "from": "human", "value": "class TreeBuilderReportSavedReports < TreeBuilderReportReportsClass\n private\n\n def tree_init_options(tree_name)\n {\n :full_ids => true,\n :leaf => 'MiqReportResult'\n }\n ...
ruby
chosen
[ { "from": "system", "value": "Add dependency on \"zookeeper\" gem.\n" }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = %q{bud}\n s.version = \"0.0.1\"\n s.date = %q{2010-07-19}\n s.authors = [\"Joseph M. Hellerstein\"]\n s.email = %q{jmh@berkeley.edu}\n s.summary = ...
ruby
chosen
[ { "from": "system", "value": "Add spec for File.owned? and fix a bug\n\nAdd spec for File.owned?, plus fix an error inside of rubinius\nimplementation: when a file was missing an exception was raised\ninstead of returning false.\nDelete a duplicated definition of File.owned? inside of¬\nkernel/common/file.r...
ruby
chosen
[ { "from": "system", "value": "Add a test covering the default value of image_upload_path.\n" }, { "from": "human", "value": "require \"test_helper\"\n\ndescribe Serif::Config do\n subject do\n Serif::Config.new(testing_dir(\"_config.yml\"))\n end\n\n describe \"#admin_username\" do\n it...
ruby
chosen
[ { "from": "system", "value": "Fix license typo in gemspec" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nlib = File.expand_path(\"../lib\", __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire \"ced/version\"\n\nGem::Specification.new do |gem|\n gem.name ...
ruby
chosen
[ { "from": "system", "value": "Remove old tests for listable aliases.\n" }, { "from": "human", "value": "require File.expand_path('../../test_helper', __FILE__)\n\nmodule Paid\n class AliasTest < Test::Unit::TestCase\n should \"aliases should be listable\" do\n @mock.expects(:get).once.r...
ruby
chosen
[ { "from": "system", "value": "Allow add_step to take a block again\nexecute checks to see if the controller responds to max_step_reached= before just calling it\n\n\ngit-svn-id: bbecf9db08a75a77aa31d13d235dbc25c5353c8b@21 82013aef-fb27-0410-99a1-c1893322ecab\n" }, { "from": "human", "value": "mo...
ruby
chosen
[ { "from": "system", "value": "Remove error catching for UnknownError\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery\n\n before_filter :get_user\n helper_method :no_users?\n\n rescue_from ActiveRecord::RecordNotFound, :with => :r...
ruby
chosen
[ { "from": "system", "value": "Remove headers cache only on logout\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: :ex...
ruby
chosen
[ { "from": "system", "value": "Remove basic http auth on prod\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: :excepti...
ruby
chosen
[ { "from": "system", "value": "Add comparison operator to BloodPressure\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Renalware\n class BloodPressure < NestedAttribute\n attribute :systolic, Integer\n attribute :diastolic, Integer\n\n validates :systolic, nu...
ruby
chosen
[ { "from": "system", "value": "Add map copier dependency\nBefore it was taken implicitly from the controllers\n" }, { "from": "human", "value": "# encoding: utf-8\n\nmodule CartoDB\n module Visualization\n class TableBlender\n def initialize(user, tables=[])\n @user = user\n ...
ruby
chosen
[ { "from": "system", "value": "Add comment to clarify intent\n" }, { "from": "human", "value": "module RequireNested\n # See also: include_concern\n def require_nested(name)\n return if const_defined?(name, false)\n\n filename = \"#{self}::#{name}\".underscore\n filename = name.to_s.un...
ruby
chosen
[ { "from": "human", "value": "Add Xoctave, a commercial IDE for GNU Octave\n" }, { "from": "gpt", "value": "cask :v1 => 'xoctave' do\n version :latest\n sha256 :no_check\n\n url 'http://www.xoctave.com/demo/xoctave%20demo.dmg'\n name 'Xoctave'\n homepage 'http://www.xoctave.com/'\n license ...
ruby
chosen
[ { "from": "system", "value": "Downgrade instance variable to local\n\nLearn your place, local variable!\n" }, { "from": "human", "value": "# Sudokuru!\n# Ruby Sudoku puzzle solver at the speed of light.\n\nputs \"\"\nputs \"Let's solve some Sudoku!\"\n\nif ARGV[0] != nil\n\t@input_file = ARGV[0]...
ruby
chosen
[ { "from": "system", "value": "Add set_expiry method to ApplicationController\n\nAs we'll need to consistently (and easily) set cache control headers,\nadd a protected method to ApplicationController.\n" }, { "from": "human", "value": "require \"slimmer/headers\"\n\nclass ApplicationController < ...
ruby
chosen
[ { "from": "system", "value": "Fix facebook error handling from ApplicationController\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_fro...
ruby
chosen
[ { "from": "system", "value": "Add default protocol for urls\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: :exceptio...
ruby
chosen
[ { "from": "system", "value": "Remove app controller comment cruft.\n" }, { "from": "human", "value": "# Filters added to this controller apply to all controllers in the application.\n# Likewise, all the methods added will be available for all controllers.\n\nclass ApplicationController < ActionC...
ruby
chosen
[ { "from": "system", "value": "Remove logged_in? restriction on grabbing webmentions. Solves a problem where the RSS feed would blow up when visited by an unauthenticated user.\n" }, { "from": "human", "value": "class WebmentionsController < ApplicationController\n before_action :require_login, ...
ruby
chosen
[ { "from": "system", "value": "Add session information to the logs\n\n* This makes easier to investigate problems during development\nbut also will help us to identify problems on the tests and production\nenvironments.\n" }, { "from": "human", "value": "module Wpcc\n class EngineController < Wp...
ruby
chosen
[ { "from": "system", "value": "Add basic api status check and getmeas call\n" }, { "from": "human", "value": "\nclass WiScale\n\nend\n\n" }, { "from": "gpt", "value": "require 'rubygems'\nrequire 'httparty'\nrequire 'json'\nrequire 'ostruct'\n\n\nclass WiScale\n\n def initialize(*par...
ruby
chosen
[ { "from": "system", "value": "Add place_id and neighborhood_ids as filters\n" }, { "from": "human", "value": "class Development\n module Scopes\n extend ActiveSupport::Concern\n\n included do\n default_scope { includes(:place) }\n\n ranged_scopes :created_at, :updated_at, :heigh...
ruby
chosen
[ { "from": "system", "value": "Add allow_blank: false property for lang and role attributes\n" }, { "from": "human", "value": "# == Schema Information\n#\n# Table name: newsletter_users\n#\n# id :integer not null, primary key\n# email :string(255)\n# lang :string(25...
ruby
chosen
[ { "from": "system", "value": "Add created at field to date field\n" }, { "from": "human", "value": "class ImportConnectionDataJob < Que::Job\n # rubocop:disable Metrics/MethodLength\n # rubocop:disable Metrics/AbcSize\n def run(connection_id)\n ActiveRecord::Base.transaction do\n conn...
ruby
chosen
[ { "from": "system", "value": "Use the new Ruby 1.9 hash syntax.\n" }, { "from": "human", "value": "module Socializer\n module ApplicationHelper\n def signin_path(provider)\n \"/auth/#{provider.to_s}\"\n end\n\n def current_user?(user)\n user == current_user\n end\n\n de...
ruby
chosen
[ { "from": "system", "value": "Add the tax_category_id for each adjustement\n\n- This tax_category_id could be null\n - Special case if the originator is a Spree::TaxRate: then use the tax_category_id of the originator\n\nCo-Authored-By: Matt-Yorkley <52dd53e39aabc3ad9893bf4bdc49ac9095b2e246@users.noreply.gi...
ruby
chosen
[ { "from": "system", "value": "Use wider load path searching to accomodate older Rails versions\n" }, { "from": "human", "value": "require 'active_record'\n\nmodule ConsistencyFail\n class Engine\n MODEL_DIRECTORY_REGEXP = /models/\n\n def preload_all_models\n model_dirs = Rails.confi...
ruby
chosen
[ { "from": "system", "value": "Improve \"Proxy not resolved\" error message (add type name).\n\nThis commit adds the type name of this frequent error message,\nto help debugging what's wrong.\n" }, { "from": "human", "value": "module Finitio\n class ProxyType < Type\n\n def initialize(target_...
ruby
chosen
[ { "from": "system", "value": "Remove logging from execute and define new execute_debug method.\n" }, { "from": "human", "value": "module SQLite3\n class Database\n def initialize(filename)\n @handle = Pointer.new(::Sqlite3.type)\n\n result = sqlite3_open(filename, @handle)\n r...
ruby
chosen
[ { "from": "system", "value": "Change the default limit of signable templates\n" }, { "from": "human", "value": "module Signable\n module Concerns\n module Query\n extend ActiveSupport::Concern\n\n def save\n return false unless valid?\n persisted? ? update : create\n ...
ruby
chosen
[ { "from": "system", "value": "Refactor MethodBondage (but it's still failing)" }, { "from": "human", "value": "module SLG\n module Meta\n module MethodBondage\n def self.trace!(traced_method)\n target = traced_method.target\n target = target.metaclass if traced_method.type...
ruby
chosen
[ { "from": "system", "value": "[rubocop] C: Use \\ instead of + or << to concatenate those strings.\n" }, { "from": "human", "value": "namespace :service do\n # @usage\n # rake service:create_account data='{ name: \"Test\", account: \"account\", password: \"pass\" }'\n task :create_account =...
ruby
chosen