conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Fix setting constant profiles in TechnologyLoad calculator\n" }, { "from": "human", "value": "module Calculation\n # Given\n class TechnologyLoad\n def self.call(context)\n new(context).run\n end\n\n def initialize(context)\n @context = context\...
ruby
chosen
[ { "from": "system", "value": "Use HasSchedule concern like in Profile\n" }, { "from": "human", "value": "require_dependency \"renalware/hd\"\n\nmodule Renalware\n module HD\n class PreferenceSet < ActiveRecord::Base\n include PatientScope\n include Accountable\n extend Enumeri...
ruby
chosen
[ { "from": "system", "value": "Fix error with using AR object in cache key\n" }, { "from": "human", "value": "collection @countries\ncache [I18n.locale, @countries]\nextends \"spree/api/countries/show\"\n" }, { "from": "gpt", "value": "collection @countries\ncache I18n.locale\nextends...
ruby
chosen
[ { "from": "system", "value": "Copy the description from the readme\n" }, { "from": "human", "value": "# coding: utf-8\n\nGem::Specification.new do |spec|\n spec.name = 'stoplight'\n spec.version = '0.3.1' # Stoplight::VERSION\n spec.summary = 'Traffic control for code.'\n spec.description = ...
ruby
chosen
[ { "from": "system", "value": "Change status to :unauthorized in cancancan rescue_from\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n protect_from_forgery with: :exception\n\n before_action :configure_permitted_parameters, if: :devise_controller?\n\n ...
ruby
chosen
[ { "from": "system", "value": "Add helper method hints to appcontroller\n" }, { "from": "human", "value": "class ApplicationController < ActionController::Base\n\t# Prevent CSRF attacks by raising an exception.\n\t# For APIs, you may want to use :null_session instead.\n\tprotect_from_forgery with...
ruby
chosen
[ { "from": "system", "value": "Set the filter to automatic generate full qualified 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_f...
ruby
chosen
[ { "from": "system", "value": "Revert \"groups: you shouldn't need to be logged in to view the home page.\"\n\nThis reverts commit 6ca837731856b5cdb5c0253aa41e268421d64690.\n" }, { "from": "human", "value": "class Groups::HomeController < Groups::BaseController\n\n layout 'sidecolumn'\n helper ...
ruby
chosen
[ { "from": "human", "value": "Add script for downloading definitions\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\n# get definitions and add to word list\n\nrequire 'net/http'\nrequire 'rexml/document'\n\nSTDERR.puts \"Reading words...\"\ndictionary = {}\nFile.open(\"defs.txt\") do |list|...
ruby
chosen
[ { "from": "system", "value": "Drop wait command to free up workers\n" }, { "from": "human", "value": "class CDNExpiryWorker\n include Sidekiq::Worker\n\n def perform(paths = [])\n raise \"Requires distribution ID\" if ENV['CDN_DISTRIBUTION'].nil?\n distribution = $cdn.distributions.get(E...
ruby
chosen
[ { "from": "system", "value": "Enable Hackney and its associated locations\n\nEnables Hackney and its associated booking centres for online bookings.\n" }, { "from": "human", "value": "if Rails.env.staging?\n # Hackney and its associated locations\n Locations.online_booking_location_uids = %w(\...
ruby
chosen
[ { "from": "system", "value": "Remove the crap from the actors controller.\n" }, { "from": "human", "value": "class ActorsController < ApplicationController\n # GET /actors\n # GET /actors.json\n def index\n @actors = Actor.all\n\n respond_to do |format|\n format.html # index.html.e...
ruby
chosen
[ { "from": "system", "value": "Support profile unification by email\n" }, { "from": "human", "value": "module WithOmniauth\n extend ActiveSupport::Concern\n\n module ClassMethods\n def omniauth(auth)\n where(auth.slice(:provider, :uid)).first_or_initialize.tap do |user|\n extract...
ruby
chosen
[ { "from": "system", "value": "Add code to seed location table with two endpoints from location json\n" }, { "from": "human", "value": "require 'csv' \nrequire 'faraday'\n\nSchool.delete_all \n\nlocation = Location.first\nurl = URI(location.endpoint)\nconnection = Faraday.new(url: url.to_s)\nre...
ruby
chosen
[ { "from": "system", "value": "Update | Operations config & validations\n" }, { "from": "human", "value": "module Setup\n class Operation < Webhook\n\n build_in_data_type.including(:resource).referenced_by(:resource, :method)\n\n deny :create\n\n belongs_to :resource, class_name: Setup:...
ruby
chosen
[ { "from": "human", "value": "Test for Binay search with rspec\n" }, { "from": "gpt", "value": "require './binary_search'\n\ndescribe \"#binary_search\" do\n context \"Test empty array\" do\n it{ binary_search([], 1).should eq(-1) }\n end\n\n context \"Search last key\" do \n it{ binary_...
ruby
chosen
[ { "from": "system", "value": "Modify SendmailJob to set mail_from, mail_from_name\n" }, { "from": "human", "value": "module SendgridNotification\n class SendmailJob < ActiveJob::Base\n queue_as :sendmail\n\n MailerClass = Rails.application.config.sendgrid_notification.mailer.constantize\n...
ruby
chosen
[ { "from": "system", "value": "Remove nil value from variant's drugs array\n\nThe array_agg aggregation function we use in the\napp/datatables/variant_browse_table.rb select_query doesn't remove nil\nvalues, which happends for variants that have evidence items that don't\nhave a drug.\n" }, { "from":...
ruby
chosen
[ { "from": "system", "value": "Add new attributes to RegionalSweden\n" }, { "from": "human", "value": "module Billogram\n class RegionalSweden < Resource\n attr_accessor :rotavdrag, :rotavdrag_personal_number, :rotavdrag_description,\n :reversed_vat, :rotavdrag_account, :rotavdrag_sum, :...
ruby
chosen
[ { "from": "system", "value": "Support listing missing top-level directories in knife serve\n" }, { "from": "human", "value": "require 'chef/chef_fs/file_system/base_fs_dir'\nrequire 'chef/chef_fs/file_system/nonexistent_fs_object'\nrequire 'chef/chef_fs/file_system/memory_file'\n\nclass Chef\n ...
ruby
chosen
[ { "from": "system", "value": "Make name and executor publicly accessible\n" }, { "from": "human", "value": "module Concurrent\n module Actress\n\n # delegates publicly expose-able methods calls to Core\n module CoreDelegations\n def path\n core.path\n end\n\n def par...
ruby
chosen
[ { "from": "system", "value": "Allow security itself to access imported certs\n" }, { "from": "human", "value": "require 'shellwords'\n\nmodule Fastlane\n module Actions\n class ImportCertificateAction < Action\n def self.run(params)\n command = \"security import #{params[:certifi...
ruby
chosen
[ { "from": "system", "value": "Remove from database, when image doesn’t exist\n" }, { "from": "human", "value": "# desc \"Explaining what the task does\"\n# task :scenery_of_flexslider do\n# # Task goes here\n# end\n\n# desc \"Explaining what the task does\"\n# task :gallery do\n# # Task goes...
ruby
chosen
[ { "from": "system", "value": "Truncate floating point element coordinates" }, { "from": "human", "value": "require \"watir/extensions/element/screenshot/version\"\nrequire 'chunky_png'\n\nmodule Watir\n class Element\n def screenshot(dest)\n file = Tempfile.new('sc')\n begin\n ...
ruby
chosen
[ { "from": "system", "value": "Fix crazy slow dev-mode exception pages using targeted .inspect monkeypatches\n" }, { "from": "human", "value": "# Copyright (c) 2010, Diaspora Inc. This file is\n# licensed under the Affero General Public License version 3 or later. See\n# the COPYRIGHT fil...
ruby
chosen
[ { "from": "system", "value": "Remove unused config for tests\n" }, { "from": "human", "value": "CarrierWave.configure do |config|\n if Rails.env.production?\n config.asset_host = 'http://infra.stru.ctu.re';\n else\n config.asset_host = 'http://localhost:4000';\n end\nend\n\nif Rails.env...
ruby
chosen
[ { "from": "system", "value": "Tweak the description formatting so the output string isn't so ugly.\n" }, { "from": "human", "value": "spec = Gem::Specification.new do |s|\n\n s.name = 'bamboo_rails'\n s.version = '0.99.0'\n s.date = '2009-05-06'\n s.authors = ['Graeme Mathieson', '...
ruby
chosen
[ { "from": "human", "value": "Migrate to new custom rate limits implementation.\n" }, { "from": "gpt", "value": "class CustomRateLimits < Mongoid::Migration\n def self.up\n ApiUser.all.each do |user|\n print \".\"\n\n unthrottled = user.read_attribute(:unthrottled)\n hourly_lim...
ruby
chosen
[ { "from": "system", "value": "Add v in front of version for git tag\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\nrequire_relative '../../lib/buildpack-release-story-creator'\n\nbuildpack_name = ENV.fetch('BUILDPACK_NAME')\nprevious_buildpack_version = File.read('buildpack/VERSION')\...
ruby
chosen
[ { "from": "system", "value": "Configure helpers admin index page." }, { "from": "human", "value": "ActiveAdmin.register User do\n\n member_action :become, method: :get do\n begin\n user = User.find(params[:id])\n login(user)\n redirect_to root_path\n rescue\n redirect_...
ruby
chosen
[ { "from": "system", "value": "Reset not found for Github pods.\n" }, { "from": "human", "value": "require 'sinatra/base'\nrequire 'app/models'\n\nclass MetricsApp < Sinatra::Base\n get '/api/v1/status' do\n {\n :github => {\n :total => GithubPodMetrics.count,\n :complete =...
ruby
chosen
[ { "from": "system", "value": "Modify Ruby Kata 'How old will you be in ...'\n" }, { "from": "human", "value": "def shortcut(s)\n\n # Use String#gsub to find all lowercase vowels (RegExp)\n # and replace them with ''\n s.gsub(/[aeiou]/, '')\n \nend" }, { "from": "gpt", "value": "d...
ruby
chosen
[ { "from": "human", "value": "Add original yaml_backend for Hiera 1.x.\n" }, { "from": "gpt", "value": "class Hiera\n module Backend\n class Yaml_backend\n def initialize(cache=nil)\n require 'yaml'\n Hiera.debug(\"Hiera YAML backend starting\")\n\n @cache = cache ||...
ruby
chosen
[ { "from": "system", "value": "Replace `render :nothing` with `head`\n\nfixes Houdini/two_factor_authentication#147\n" }, { "from": "human", "value": "module TwoFactorAuthentication\n module Controllers\n module Helpers\n extend ActiveSupport::Concern\n\n included do\n before...
ruby
chosen
[ { "from": "system", "value": "Fix checksum in Thunder.app Cask\n" }, { "from": "human", "value": "cask :v1 => 'thunder' do\n version '2.6.7.1706'\n sha256 '0eb7fa7e1448eebb3b60c4fa849888fff8697d20474771d0ad3001f4f5b3274d'\n\n # sandai.net is the official download host per the vendor homepage\...
ruby
chosen
[ { "from": "human", "value": "Add some test code for EventDispatcher class\n" }, { "from": "gpt", "value": "require 'spec_helper'\n\nRSpec.describe Twterm::EventDispatcher do\n let(:event_dispatcher) { described_class.instance }\n\n describe '#dispatch' do\n subject { event_dispatcher.dispat...
ruby
chosen
[ { "from": "system", "value": "Use tabularize for product list\n" }, { "from": "human", "value": "require 'MrMurano/Account'\nrequire 'terminal-table'\n\ncommand 'product list' do |c|\n c.syntax = %{mr product list [options]}\n c.description = %{List products}\n c.option '--idonly', 'Only retu...
ruby
chosen
[ { "from": "system", "value": "Add debug for full text search initialization\n" }, { "from": "human", "value": "class String\n def to_bool\n return true if self == true || self =~ (/^(true|t|yes|y|1)$/i)\n return false if self == false || self.blank? || self =~ (/^(false|f|no|n|0)$/i)\n ...
ruby
chosen
[ { "from": "system", "value": "Add documentation to TinyURL class\n" }, { "from": "human", "value": "module LinkShrink\n module Shrinkers\n # @author Jonah Ruiz <jonah@pixelhipsters.com>\n # Implements Tiny URL Shortener API\n class TinyUrl < Base\n def base_url\n 'http://ti...
ruby
chosen
[ { "from": "system", "value": "Fix migration issue for mysql with index not being removed\n\nSigned-off-by: Dmitriy Zaporozhets <be23d75b156792e5acab51b196a2deb155d35d6a@gmail.com>\n" }, { "from": "human", "value": "class AddIdentityTable < ActiveRecord::Migration\n def up\n create_table :ide...
ruby
chosen
[ { "from": "system", "value": "Monitor callback must respond to :call\n" }, { "from": "human", "value": "module Rails\n module Auth\n module Monitor\n # Fires a user-specified callback which reports on authorization success\n # or failure. Useful for logging or monitoring systems fo...
ruby
chosen
[ { "from": "system", "value": "Use enum in log-level option\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule TrySailBlogNotification\n class Cli < Thor\n\n class_option 'log-level', desc: 'Set the logger level (fatal, error, warn, info, debug).', type: :string\n\n ...
ruby
chosen
[ { "from": "system", "value": "Add a test for some params and all params\n" }, { "from": "human", "value": "require 'test_helper'\n\nmodule TastesBitter\n\n class JavascriptErrorsControllerTest < ActionController::TestCase\n\n # setup do\n # @routes = Engine.routes\n # end\n\n test...
ruby
chosen
[ { "from": "system", "value": "Remove override for platform in gemspec\n\nSeems not to depend on any special platform. See http://guides.rubygems.org/specification-reference/#platform=" }, { "from": "human", "value": "require File.expand_path('../lib/carrierwave-imagesorcery/version', __FILE__)\n...
ruby
chosen
[ { "from": "system", "value": "Switch to [\"\"] format instead of [:]\n" }, { "from": "human", "value": "module Helpers\n module Runit\n include MiniTest::Chef::Assertions\n include MiniTest::Chef::Context\n include MiniTest::Chef::Resources\n\n def assert_package_i...
ruby
chosen
[ { "from": "human", "value": "Add rule to remove invalid Org contact_emails\n" }, { "from": "gpt", "value": "# frozen_string_literal: true\nmodule DataCleanup\n module Rules\n # Fix invalid email on Org\n module Org\n class FixInvalidEmail < Rules::Base\n\n def description\n ...
ruby
chosen
[ { "from": "system", "value": "Add failing test case for SystemStackError\n" }, { "from": "human", "value": "# coding: utf-8\n\nrequire 'spec_helper'\n\nclass Model; end\n\ndescribe ActiveInteraction::ModelFilter, :filter do\n include_context 'filters'\n it_behaves_like 'a filter'\n\n before d...
ruby
chosen
[ { "from": "system", "value": "Remove debug comment from script loader\n" }, { "from": "human", "value": "class BrowserScriptLoader\n def run\n handler = proc { find_scripts }\n\n if $global.respond_to? :addEventListener\n $global.addEventListener 'DOMContentLoaded', handler, false\n ...
ruby
chosen
[ { "from": "system", "value": "Add aditiona specs for session document validity\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire \"rails_helper\"\n\nmodule Renalware\n module HD\n describe SessionDocument::Dialysis, type: :model do\n describe \"validation\" do\...
ruby
chosen
[ { "from": "system", "value": "Remove authentication and rely on host app to monkeypatch DjReportsController\n" }, { "from": "human", "value": "module DjMon\n class DjReportsController < ActionController::Base\n respond_to :json, :html\n layout 'dj_mon'\n\n before_filter :authenticate, ...
ruby
chosen
[ { "from": "human", "value": "Correct the parent tags on new mainstream categories\n" }, { "from": "gpt", "value": "MainstreamCategory.where(parent_tag: 'citizenship/internationial-funding').each do |category|\n puts \"Updating parent tag on category '#{category.title}'\"\n category.update_attr...
ruby
chosen
[ { "from": "system", "value": "Stop including spec's in the gemspec file\n" }, { "from": "human", "value": "# coding: utf-8\nlib = File.expand_path('../lib', __FILE__)\n$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)\nrequire 'wisper/rspec/version'\n\nGem::Specification.new do |spec|\n s...
ruby
chosen
[ { "from": "system", "value": "Add logging around route registration.\n\nOccasionally we've seen Router::RemoteErrors occur on deployment. This\nlogging should give us a better chance of diagnosing what the problem\nis.\n" }, { "from": "human", "value": "require \"router\"\n\nrouter = Router.new(...
ruby
chosen
[ { "from": "system", "value": "Change POST to GET for ipn controller route\n" }, { "from": "human", "value": "Spree::Core::Engine.routes.draw do\n post 'amazon/fps' => 'amazon#fps'\n post 'amazon/ipn' => 'amazon#ipn'\n get 'amazon/complete' => 'amazon#complete'\n get 'amazon/abort' => 'amazon...
ruby
chosen
[ { "from": "system", "value": "Remove specific error class check when checking not failed\n" }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe Netsweet::SSO do\n\n Given(:id) { new_id }\n Given(:customer_attributes) do\n { external_id: id,\n email: gen_email,\n firs...
ruby
chosen
[ { "from": "system", "value": "Use long polling on cloudwatch_scheduler queue\n" }, { "from": "human", "value": "Shoryuken.configure_server do |_config|\n # Replace Rails logger so messages are logged wherever Shoryuken is logging\n # Note: this entire block is only run by the processor, so we ...
ruby
chosen
[ { "from": "human", "value": "Add assets_path to spec helpers\n" }, { "from": "gpt", "value": "module AssetsHelper\n def assets_path *parts\n File.join(File.dirname(__FILE__), '..', 'assets', *parts)\n end\nend\n\nRSpec.configure do |config|\n config.include AssetsHelper\nend\n" } ]
ruby
chosen
[ { "from": "system", "value": "Include rake in gemspec (available to bundle exec)\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nGem::Specification.new do |gem|\n gem.authors = [\"John Bintz\"]\n gem.email = [\"john@coswellproductions.com\"]\n gem.description = %...
ruby
chosen
[ { "from": "system", "value": "Use yield instead of block.call\n" }, { "from": "human", "value": "if RUBY_VERSION >= '1.9'\n require 'simplecov'\n require 'coveralls'\n\n SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter]\n\n SimpleCov.start do\n ...
ruby
chosen
[ { "from": "system", "value": "Disable forcing whitelist attributes from protected attributes\n\nThis was the previous functionality since we didn't set anything in the\napplication configuration. Now when using protected attributes gem, it\nsets whitelist to true, forcing us to always declare the accessible...
ruby
chosen
[ { "from": "system", "value": "Remove deprecated `has_rdoc` from gemspec\n\nFixes #93" }, { "from": "human", "value": "version_from_source = lambda do |file|\n File.open(File.expand_path(\"../#{file}\", __FILE__)) do |source|\n source.detect { |line| line =~ /\\bversion\\b.+\"(.+?)\"/i }\n e...
ruby
chosen
[ { "from": "system", "value": "Add alternate format names to backend parser\n\nThis change lets us search supported formats for multiple names, rather\nthan a single one. The reason for this is if imagemagick supports .avif,\nit shows 'heic' instead.\n" }, { "from": "human", "value": "module Pict...
ruby
chosen
[ { "from": "system", "value": "Add even more logging for states cache event handler\n" }, { "from": "human", "value": "module Travis\n module Addons\n module StatesCache\n class EventHandler < Event::Handler\n EVENTS = /build:finished/\n\n def handle?\n !pull_reque...
ruby
chosen
[ { "from": "system", "value": "Fix when type doesn't exist\n" }, { "from": "human", "value": "# frozen_string_literal: true\nmodule GraphQL\n module Introspection\n class EntryPoints < Introspection::BaseObject\n field :__schema, GraphQL::Schema::LateBoundType.new(\"__Schema\"), \"This G...
ruby
chosen
[ { "from": "system", "value": "Remove commented line and use the attr_reader\n" }, { "from": "human", "value": "require 'stepping_stone/text_mapper/pattern'\n\nmodule SteppingStone\n module TextMapper\n class Mapping\n def self.from_fluent(dsl_args)\n from, to = dsl_args.shift\n ...
ruby
chosen
[ { "from": "system", "value": "Use .is_a?(Class) instead of .respond_to?(:new)\n" }, { "from": "human", "value": "module AccessGranted\n class Permission\n attr_reader :action, :subject, :granted, :conditions\n\n def initialize(granted, action, subject, user = nil, conditions = {}, block =...
ruby
chosen
[ { "from": "system", "value": "Add sunspot_rails:install to Rails app template\n\nFixes #381\n" }, { "from": "human", "value": "require 'pathname'\n\ngenerating_dummy = ARGV.include? \"--dummy\"\ncalagator_checkout = Pathname.new(File.expand_path(\"..\", __FILE__))\nrelative_calagator_path = cala...
ruby
chosen
[ { "from": "system", "value": "Set spec type to controller\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe EventsController do\n describe 'create' do\n end\nend\n" }, { "from": "gpt", "value": "require 'rails_helper'\n\nRSpec.describe EventsController, ty...
ruby
chosen
[ { "from": "system", "value": "Fix deprecation warnings in exit code matcher.\n" }, { "from": "human", "value": "# https://gist.github.com/mmasashi/58bd7e2668836a387856\nRSpec::Matchers.define :terminate do |code|\n actual = nil\n\n def supports_block_expectations?\n true\n end\n\n match d...
ruby
chosen
[ { "from": "system", "value": "Add pending specs to test options limit, allow_destroy, update_only with accepts_nested_attributes_of matcher." }, { "from": "human", "value": "require 'spec_helper'\n\ndescribe \"AcceptsNestedAttributes\" do\n describe User do\n it { should accept_nested_attrib...
ruby
chosen
[ { "from": "system", "value": "Add signed_in? as a helper method\n" }, { "from": "human", "value": "module Authem::ControllerSupport\n extend ActiveSupport::Concern\n\n protected\n\n def sign_in(user, remember_me=true)\n cookies.permanent.signed[:remember_token] = user.remember_token if rem...
ruby
chosen
[ { "from": "system", "value": "Enable to load rails yaml file\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nrequire 'yaml'\n\nmodule BankWorkingDay\n class Holiday\n def initialize(date, name)\n @date = date\n @name = name\n end\n end\n\n class Holidays\n attr_...
ruby
chosen
[ { "from": "system", "value": "Use max_allowed_packet as hard limit on MySQL\n" }, { "from": "human", "value": "module FullTextSearch\n module SettingsObjectize\n def plugin_full_text_search\n Settings.new(super)\n end\n end\n\n class Settings\n TRUE_VALUE = \"1\"\n\n def init...
ruby
chosen
[ { "from": "human", "value": "Add test for presente validation\n" }, { "from": "gpt", "value": "require 'test_helper'\n\nclass SimpleFormAdaptTest < ActionView::TestCase\n test \"add attribute require when model has presence validation\" do\n parsley_concat_form(@company) do |f|\n f.inpu...
ruby
chosen
[ { "from": "system", "value": "Set devise rememberable to match session cookie\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\nRails.application.config.session_store :cookie_store, key: '_dabbleme_session'\n" }, { "from": "gpt", "value...
ruby
chosen
[ { "from": "system", "value": "Disable sessions/don't set a session cookie\n\nAs I understand it, our frontend apps don't use sessions and, except for\nLicensing, they are stripped off requests and responses by our Varnish\nconfiguration in puppet.\n\nSo this should make dev more like production and avoid ac...
ruby
chosen
[ { "from": "system", "value": "Fix translation for vesr settings menu item.\n" }, { "from": "human", "value": "SimpleNavigation::Configuration.run do |navigation|\n\n # user navigation\n navigation.items do |primary|\n primary.item :login, t('sessions.new.title'), '#', :highlights_on => /\\/...
ruby
chosen
[ { "from": "system", "value": "Update chef client to 13.9.4\n" }, { "from": "human", "value": "# Add the opscode APT source for chef\ndefault[:apt][:sources] = node[:apt][:sources] | [\"opscode\"]\n\n# Set the default server version\ndefault[:chef][:server][:version] = \"12.13.0-1\"\n\n# Set the ...
ruby
chosen
[ { "from": "system", "value": "Make sure group exists before user is added\n" }, { "from": "human", "value": "#\n# Cookbook Name:: mongodb\n# Description:: Base configuration for mongodb\n# Recipe:: default\n# Author:: brandon.bell\n#\n# Copyright 2011, Chr...
ruby
chosen
[ { "from": "system", "value": "Add g5_access_token to user factory\n" }, { "from": "human", "value": "# Read about factories at https://github.com/thoughtbot/factory_girl\n\nFactoryGirl.define do\n factory :g5_authenticatable_user, :class => 'G5Authenticatable::User' do\n sequence(:email) { |...
ruby
chosen
[ { "from": "system", "value": "Delete print out from test\n" }, { "from": "human", "value": "require 'rails_helper'\n\nRSpec.describe 'projects/index', type: :view do\n before(:each) do\n @user = FactoryGirl.create(:user)\n login_as @user\n\n end\n\n it 'changes checkbox id after user wa...
ruby
chosen
[ { "from": "system", "value": "Add test for diary index\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass DiariesControllerTest < ActionController::TestCase\n def setup\n @user = users(:joe)\n @other_user = users(:user_1)\n end\n\n test 'should redirect get new when not l...
ruby
chosen
[ { "from": "system", "value": "Use gir_ffi version that does not require libgirepository1.0-dev package\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nGem::Specification.new do |s|\n s.name = 'gir_ffi-cairo'\n s.version = '0.0.13'\n\n s.summary = 'GirFFI-based bindings for...
ruby
chosen
[ { "from": "system", "value": "Move to Rails 3 format for a root url.\n" }, { "from": "human", "value": "# Here you can override or add to the pages in the core website\n\nRails.application.routes.draw do\n # Add a route for the survey\n scope '/profile/survey' do\n match '' => 'user...
ruby
chosen
[ { "from": "system", "value": "Add simple array coercion / destruction to Object class\n\nUseful when you dealing with [Array or Object] type of object e.g. XML\nresults.\n" }, { "from": "human", "value": "class Object\r\n\r\n def superclasses\r\n return [] if self.nil?\r\n x = self.superc...
ruby
chosen
[ { "from": "system", "value": "Add Asian Network and World Service streams\n" }, { "from": "human", "value": "=begin\nIn order to fake a radio, we need to stream radio content.\nBBC Radio streams are playlist files, which contain\na link to a time-restricted audio stream.\n\nEvery few hours, the ...
ruby
chosen
[ { "from": "system", "value": "Add delete method to RRCache\n" }, { "from": "human", "value": "require_relative 'base_cache'\n\nmodule Cache\n # Randomly selects a candidate item and discards it to make space when necessary. \n # This algorithm does not require keeping any information about the...
ruby
chosen
[ { "from": "system", "value": "Make sure rack_cache[:verbose] can be set\n\nThis exploded for me.\nCopied a commit from lograge which solved the same issue:\nhttps://github.com/roidrage/lograge/pull/103\n" }, { "from": "human", "value": "require 'rails/railtie'\nrequire 'action_view/log_subscribe...
ruby
chosen
[ { "from": "human", "value": "Add support for unpacking PalmDoc-compressed contents\n" }, { "from": "gpt", "value": "#!/usr/bin/env ruby\n\nclass Mobipocket::Unpack::PalmDoc \n attr_accessor :unpacked\n\n def initialize(input)\n @unpacked = unpack(input)\n return self\n end\n \n def u...
ruby
chosen
[ { "from": "human", "value": "Add a test for trackvar_def sexpr rule.\n" }, { "from": "gpt", "value": "require 'spec_helper'\nmodule Gisele::Language\n describe \"the Sexp grammar\", \"trackvar_def\" do\n\n let(:g){ Gisele::Language }\n\n it 'matches a trackvar with initial value' do\n ...
ruby
chosen
[ { "from": "system", "value": "Add ffi gem as dependency, as needed by spoon gem.\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\n$:.push File.expand_path(\"../lib\", __FILE__)\nrequire \"guard/webrick/version\"\n\nGem::Specification.new do |s|\n s.name = \"guard-webrick\"\n...
ruby
chosen
[ { "from": "system", "value": "Set cron to be an accessible attribute\n" }, { "from": "human", "value": "require 'delayed_job'\nrequire 'English'\nrequire 'delayed_cron_job/cronline'\nrequire 'delayed_cron_job/plugin'\nrequire 'delayed_cron_job/version'\n\nmodule DelayedCronJob\n\nend\n\nif defin...
ruby
chosen
[ { "from": "system", "value": "Add a dependency on yajl-ruby." }, { "from": "human", "value": "Gem::Specification.new do |s|\n s.name = 'opscode-json-session'\n s.version = '0.0.1'\n s.platform = Gem::Platform::RUBY\n s.has_rdoc = true\n s.summary = \"\"\n s.description = \"\"\n s.author =...
ruby
chosen
[ { "from": "system", "value": "Fix rsync for separated byte numbers\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\nmodule EventMachine\n class FS\n class Command < EM::SystemCommand\n\n PROGRESS_REGEXP = /([A-Za-z0-9\\.\\-\\/]+)\\n[ ]+(\\d+)/.freeze\n\n ##\n # Invo...
ruby
chosen
[ { "from": "system", "value": "Remove private .installed? used in only one place\n" }, { "from": "human", "value": "class EmbeddedAnsible\n APPLIANCE_ANSIBLE_DIRECTORY = \"/opt/ansible-installer\".freeze\n ANSIBLE_ROLE = \"embedded_ansible\".freeze\n\n def self.available?\n i...
ruby
chosen
[ { "from": "system", "value": "Fix gemspec to reference renamed Changelog.md\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.join(File.dirname(__FILE__), 'lib/gir_ffi/version.rb')\n\nGem::Specification.new do |s|\n s.name = \"gir_ffi\"\n s.version = GirFFI::VERSION\n\...
ruby
chosen
[ { "from": "system", "value": "Use local timeout for Postgres\n" }, { "from": "human", "value": "module Slowpoke\n module Migration\n def connection\n connection = super\n if Slowpoke.migration_statement_timeout && !@migration_statement_timeout_set\n connection.execute(\"SET ...
ruby
chosen
[ { "from": "system", "value": "Install bioconda channels to system\n" }, { "from": "human", "value": "#\n# Cookbook Name:: basicsetup\n# Recipe:: bioconda_install\n#\n# Copyright (c) [2015] [Manabu ISHII] and RIKEN Bioinformatics Research Unit\n# Released under the [Apache2 license]\n#\n# Instaru...
ruby
chosen
[ { "from": "system", "value": "Update the PaypalProcessor Lib for preapproval_url\n\nUpdate the PaypalProcessor lib to include a method to return the\npreapproval URL (or blank string in the case of an error).\n" }, { "from": "human", "value": "require 'devise'\n\nmodule PaypalProcessor\n def se...
ruby
chosen
[ { "from": "human", "value": "Add convenience methods to NilClass\n\nLike the methods added to String, these are only added if the user\nexplicitly requires 'wikitext/nil_class'. They add a \"w\" and a\n\"to_wikitext\" method to the NilClass.\n\nThis in turn enables code which might look like this:\n\n body...
ruby
chosen