conversations
listlengths
2
3
source
stringclasses
1 value
stack
stringclasses
1 value
[ { "from": "system", "value": "Change included file to reflect extension change\n" }, { "from": "human", "value": "$:.push File.expand_path(\"../lib\", __FILE__)\n\nrequire \"flotilla/rails/version\"\n\nGem::Specification.new do |s|\n s.name = \"flotilla-rails\"\n s.version = Flotill...
ruby
chosen
[ { "from": "system", "value": "Sort examples and groups combined\n" }, { "from": "human", "value": "module ExampleGroupTimer\n class TimedGroup < TimedItem\n attr_reader :subgroups, :examples, :current_example\n\n def initialize(*args)\n super\n @subgroups, @examples = [], []\n ...
ruby
chosen
[ { "from": "system", "value": "Add comma to handshake channel\n" }, { "from": "human", "value": "class HandshakesChannel < ApplicationCable::Channel\n def subscribed\n stream_from 'handshakes'\n end\n\n def receive(payload)\n handshake = Handshakes.create(challenge_id: payload[\"challeng...
ruby
chosen
[ { "from": "system", "value": "Refactor stock levels check in CartController\n" }, { "from": "human", "value": "class CartController < BaseController\n before_action :check_authorization\n\n def populate\n order = current_order(true)\n\n cart_service = CartService.new(order)\n\n cart_s...
ruby
chosen
[ { "from": "system", "value": "Sort tags by most used.\n" }, { "from": "human", "value": "class TagsController < ApplicationController\n def index\n @tags = ActsAsTaggableOn::Tag.all\n end\n\n def search\n @tags = ActsAsTaggableOn::Tag.where(\"name like ?\", \"%#{params[:tag_query]}%\")\...
ruby
chosen
[ { "from": "system", "value": "Use mongo client and don't attempt to fudge with system collections.\n" }, { "from": "human", "value": "$:.unshift(File.expand_path('../../lib', __FILE__))\n\nrequire 'rubygems'\nrequire 'bundler'\n\nBundler.require(:default, :test)\n\nrequire 'plucky'\n\nrequire 'f...
ruby
chosen
[ { "from": "system", "value": "Remove doc files from gemspec, since Bundler or Rubygems seems to get confused.\n" }, { "from": "human", "value": "require File.expand_path( '../../lib/m4dbi/version', __FILE__ )\n\nspec = Gem::Specification.new do |s|\n s.name = 'm4dbi'\n s.version = M4DBI::V...
ruby
chosen
[ { "from": "system", "value": "Remove methods that simply call other methods\n" }, { "from": "human", "value": "class Triangle\n attr_reader :first_side, :second_side, :third_side, :sorted_lengths, :multiplied_lengths\n\n def initialize(side_lengths)\n @sorted_lengths = side_lengths.sort\n ...
ruby
chosen
[ { "from": "system", "value": "Change .to be > 0 to be_positive\n" }, { "from": "human", "value": "Then(/^the links on the page have tracking attributes$/) do\n visit finder_path('government/policies/benefits-reform')\n\n expect(page).to have_selector('ul[data-module=\"track-click\"]')\n\n doc...
ruby
chosen
[ { "from": "system", "value": "Add cuke test for feedback feature\n" }, { "from": "human", "value": "Given(/^I visit the feedback tool$/) do\n pending # express the regexp above with the code you wish you had\nend\n\nWhen(/^I leave feedback about savings and account creation$/) do\n pending # e...
ruby
chosen
[ { "from": "system", "value": "Change config since variable name got deprecated\n" }, { "from": "human", "value": "Dysnomia::Application.configure do\n # Settings specified here will take precedence over those in config/application.rb.\n\n # The test environment is used exclusively to run your ...
ruby
chosen
[ { "from": "system", "value": "Make sure token is valid.\n" }, { "from": "human", "value": "\nclass Facebooked::ApiController < ApplicationController\n def albums\n return render :inline => 'false' unless self.provider.token\n\n response = JSON.parse(self.provider.get('/me/albums', {:field...
ruby
chosen
[ { "from": "system", "value": "Use the HashiCorp gem source for plugin installs\n" }, { "from": "human", "value": "require \"rubygems\"\nrequire \"rubygems/gem_runner\"\n\nrequire \"log4r\"\n\nmodule VagrantPlugins\n module CommandPlugin\n # This class provides methods to help with calling ou...
ruby
chosen
[ { "from": "human", "value": "Add missing test for Roadmap controller\n\nThis covers a lot of the allegedly 'unused' i18n keys.\n" }, { "from": "gpt", "value": "require \"test_helper\"\n\nclass RoadmapControllerTest < ActionController::TestCase\n context \"GET index\" do\n setup do\n con...
ruby
chosen
[ { "from": "system", "value": "Fix Bank of Canada URLs\n" }, { "from": "human", "value": "require 'source'\n\nBenchmarks =\n[\n HtmlSource.new(\n 'overnight',\n 'Target Overnight Lending Rate',\n 'http://www.bankofcanada.ca/rates/daily-digest/',\n nil,\n nil,\n '//td[text() = \...
ruby
chosen
[ { "from": "system", "value": "Use tokens in Command to add extra information to words\n" }, { "from": "human", "value": "# Mark Harder\n# 2013.02.01\n# Class to store user commands\n\nclass Command\n def initialize(tokens = [])\n @tokens = tokens\n end\n\n def to_s\n @tokens.join(\" \")...
ruby
chosen
[ { "from": "system", "value": "Remove spaces from secret token error message\n" }, { "from": "human", "value": "# Be sure to restart your server when you modify this file.\n\n# Your secret key is used for verifying the integrity of signed cookies.\n# If you change this key, all old signed cookies...
ruby
chosen
[ { "from": "system", "value": "Add FIXME for poor Passage property/method names\n" }, { "from": "human", "value": "class Passage\n\n # A passage's condition must return a truthy value, or the passage is\n # inaccessible.\n\n attr_accessor :option, :destination, :descriptions,\n :departure_d...
ruby
chosen
[ { "from": "system", "value": "Refactor test to reduce instantitiating a new TicTacToe for each test\n" }, { "from": "human", "value": "require_relative '../lib/tic_tac_toe.rb'\n\ndescribe TicTacToe do\n describe '#initialize' do\n it 'creates a empty board represented by an array of 9 slots'...
ruby
chosen
[ { "from": "human", "value": "Add a graceful shutdown handler. This handler creates a stash to be used as metadata to other handlers/processes.\n" }, { "from": "gpt", "value": "#! /usr/bin/env ruby\n#\n# Graceful Shutdown Handler\n# ===\n#\n# DESCRIPTION:\n# This handler is responsible for han...
ruby
chosen
[ { "from": "system", "value": "Add third test 'it gets a list of all transactions'\n" }, { "from": "human", "value": "require \"spec_helper\"\n\ndescribe \"Geezeo accounts\" do\n before(:each) do\n @geezeo = Geezeo.client(credentials[\"api_key\"], credentials[\"user_id\"])\n end\n\n it \"ge...
ruby
chosen
[ { "from": "system", "value": "Load database driver before load activerecord\n" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)\nrequire \"coveralls\"\nCoveralls.wear!\n\nrequire \"active_record\"\n\ncase ENV[\"DB\"]\nwhen \"postgres\"\n require \"pg\"\...
ruby
chosen
[ { "from": "system", "value": "Remove database cleaner initialization for specs\n" }, { "from": "human", "value": "ENV['RACK_ENV'] ||= 'test'\n\nrequire 'rubygems'\nrequire 'deployments-app'\nrequire 'factory_girl'\nrequire 'dm-rspec'\n\nDir[File.expand_path(\"./spec/factories/*.rb\")].each {|f| ...
ruby
chosen
[ { "from": "system", "value": "Use unary ampersand for trivial block.\n\nSigned-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>\n" }, { "from": "human", "value": "ENV['RACK_ENV'] = 'test'\nENV['COMICS_DATA_FILE'] = 'doc/example/config.json'\n\nrequire 'rsp...
ruby
chosen
[ { "from": "system", "value": "Configure rspec for documentation + color\n\nThis provides nicer output in e.g. jenkins.\n\nChange-Id: I422249b7e227c3e2064eaf1ad7186a271ada5597\nReviewed-on: https://gerrit.causes.com/23045\nTested-by: jenkins <d95b56ce41a2e1ac4cecdd398defd7414407cc08@causes.com>\nReviewed-by:...
ruby
chosen
[ { "from": "system", "value": "Send test coverage to codeclimate only for cruby\n" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)\n\nrequire 'simplecov'\nrequire 'webmock/rspec'\nrequire 'codeclimate-test-reporter'\nrequire 'pry'\n\nWebMock.disable_net_...
ruby
chosen
[ { "from": "system", "value": "Add arguments to abstract method\n" }, { "from": "human", "value": "# -*- coding: utf-8 -*-\n# Copyright 2014 TIS Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You ...
ruby
chosen
[ { "from": "system", "value": "[PodspecSource] Update message for informative error if fetch fails\n" }, { "from": "human", "value": "module Pod\n module ExternalSources\n # Provides support for fetching a specification file from an URL. Can be\n # http, file, etc.\n #\n class Podspe...
ruby
chosen
[ { "from": "system", "value": "Update attribute_struct constraint to require traversal fixed version\n" }, { "from": "human", "value": "$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) + '/lib/'\nrequire 'sparkle_formation/version'\nGem::Specification.new do |s|\n s.name = 'sparkle_fo...
ruby
chosen
[ { "from": "system", "value": "Update parameter to reflect new filename\n" }, { "from": "human", "value": "class GridOne < Grid\n\n attr_reader :program_1\n\n def initialize(window, user)\n super(window, user,\n 'media/grid_one.txt',\n 'media/grid_one_tileset.png',\n {...
ruby
chosen
[ { "from": "system", "value": "Add to log information about performing time\n" }, { "from": "human", "value": "module Crono\n class Job\n attr_accessor :performer\n attr_accessor :period\n attr_accessor :last_performed_at\n\n def initialize(performer, period)\n self.performer, s...
ruby
chosen
[ { "from": "system", "value": "Implement a Levenshtein distance for the fuzzy finder\n" }, { "from": "human", "value": "require 'discordrb/version'\nrequire 'discordrb/bot'\nrequire 'discordrb/commands/command_bot'\n\n# All discordrb functionality, to be extended by other files\nmodule Discordrb\...
ruby
chosen
[ { "from": "system", "value": "Convert boolean value on initialization\n" }, { "from": "human", "value": "module Chelsy\n\n class Node\n end\n\n class Element < Node\n end\n\n module Constant\n\n class Integral < Element\n attr_reader :value, :base\n\n def initialize(value, unsi...
ruby
chosen
[ { "from": "system", "value": ":bug: Fix accessing nil seed path env variable\n" }, { "from": "human", "value": "require 'seeder'\n\nmodule SumoSeed\n def self.seed_path\n [Rails.root, 'db', 'seeds']\n end\n\n def self.run_task\n seed_path = [Rails.root, ENV['seed_path'].split('/')].flat...
ruby
chosen
[ { "from": "system", "value": "Fix views path for production\n" }, { "from": "human", "value": "class NodefilesController < InheritedResources::Base\n\n self.append_view_path(\"vendor/plugins/nodefiles/lib/app/views\")\n\n def nodefiles\n @node = Node.find(params[:node_id])\n @node_files ...
ruby
chosen
[ { "from": "system", "value": "Include \"body\" in results-retrieve return val.\n" }, { "from": "human", "value": "module JokerAPI\n module Operations\n module ResultRetrieve\n # @param [String,Response] proc_id The String Proc-ID from the request to retrieve\n def result_retrieve(p...
ruby
chosen
[ { "from": "system", "value": "Save a little more memory by symbolizing more common strings.\n" }, { "from": "human", "value": "require 'json'\nrequire 'ruby-progressbar'\nrequire 'active_support/core_ext/hash/keys'\n\nmodule MemoryAnalyzer\n class HeapAnalyzer\n module Parser\n def self...
ruby
chosen
[ { "from": "system", "value": "Test Round url and expire_time persist on save\n" }, { "from": "human", "value": "require 'test_helper'\n\nclass RoundTest < ActiveSupport::TestCase\n test \"newly created round has randomly generated url string\" do\n r = Round.new\n assert_not_nil r.url\n ...
ruby
chosen
[ { "from": "human", "value": "Migrate payment fee adjustments to payment objects\n" }, { "from": "gpt", "value": "class MigratePaymentFeesToPayments < ActiveRecord::Migration\n class Spree::Adjustment < ActiveRecord::Base\n belongs_to :originator, polymorphic: true\n end\n\n def up\n # P...
ruby
chosen
[ { "from": "system", "value": "Use `SexpLines` for PHP parser\n\nSince we're reverting back to the old PHP parser, we need to restore the\nuse of `SexpLines`.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nrequire \"cc/engine/analyzers/php/parser\"\nrequire \"cc/engine/analyz...
ruby
chosen
[ { "from": "system", "value": "Use 'method' variable instead of String\n" }, { "from": "human", "value": "require 'hanzo/modules/installers/remotes'\nrequire 'hanzo/modules/installers/labs'\n\nmodule Hanzo\n class Install < Base\n include Hanzo::Installers::Remotes\n include Hanzo::Install...
ruby
chosen
[ { "from": "system", "value": "Insert into the correct middleware in spec\n" }, { "from": "human", "value": "require 'rails'\nrequire_relative 'rails_options'\nrequire_relative 'action_controller_helpers'\n\nmodule Rack\n module DevMark\n class Railtie < Rails::Railtie\n config.rack_dev_...
ruby
chosen
[ { "from": "system", "value": "Add rake task to be called by heroku scheduler\n" }, { "from": "human", "value": "require 'organisation_importer'\n\nnamespace :organisations do\n\n desc \"Imports organisations from the data.gov.uk hierarchy\"\n task :import => :environment do\n response = Net...
ruby
chosen
[ { "from": "system", "value": "Remove some old SQS backward compatibility stuff.\n" }, { "from": "human", "value": "module Tootsie\n\n class Configuration\n\n def initialize\n @ffmpeg_thread_count = 1\n @worker_count = 4\n @queue_options = {}\n end\n\n def update!(config)...
ruby
chosen
[ { "from": "system", "value": "Make the fact work gracefully on systems that don't have FreeRADIUS\ninstalled\n" }, { "from": "human", "value": "# Grab the FreeRADIUS version from the output of radiusd -v\nFacter.add(:freeradius_version) do\n setcode do\n Facter::Core::Execution.exec('radiusd...
ruby
chosen
[ { "from": "system", "value": "Remove reference to host/ port\n" }, { "from": "human", "value": "require 'action_dispatch/routing/route_set'\n\nmodule ActionDispatch\n module Routing\n class RouteSet #:nodoc:\n def url_for_with_subdomains(options, path_segments=nil)\n if Subdomain...
ruby
chosen
[ { "from": "system", "value": "Add test 'sample mail can clear attributes using clear_prefix'\n" }, { "from": "human", "value": "require 'test_helper'\nrequire \"fixtures/sample_mail\"\n\nclass MailFormTest < ActiveSupport::TestCase\n test \"sample mail has name and email as attributes\" do\n ...
ruby
chosen
[ { "from": "system", "value": "Fix for SuperUser => superuser\n\ncloses #720\n" }, { "from": "human", "value": "module RailsAdmin\n module Generators\n module Utils\n module InstanceMethods\n def display(output, color = :green)\n say(\" - #{output}\", color)\n ...
ruby
chosen
[ { "from": "system", "value": "Refactor block rule to allow custom body\n" }, { "from": "human", "value": "require 'parslet'\n\nrequire 'rip'\nrequire 'rip/parsers/helpers'\n\nmodule Rip::Parsers\n module BlockExpression\n include Parslet\n include Rip::Parsers::Helpers\n\n rule(:block_...
ruby
chosen
[ { "from": "system", "value": "Change the globbing importer to be at the end of the load paths instead of the front. This prevents the globbing from picking up compass sprite imports.\n" }, { "from": "human", "value": "require 'sass'\n\nclass Sass::Engine\n alias old_initialize initialize\n \n ...
ruby
chosen
[ { "from": "system", "value": "Move alias_method into included block\n" }, { "from": "human", "value": "require 'active_support/concern'\nrequire 'virtus'\nrequire 'active_model'\n\nmodule GeojsonModel\n module Base\n extend ActiveSupport::Concern\n\n included do\n include Virtus.mode...
ruby
chosen
[ { "from": "system", "value": "Set swift version in podspec file\n" }, { "from": "human", "value": "Pod::Spec.new do |s|\n\n s.name = \"JSONRequest\"\n s.version = \"0.6.0\"\n s.summary = \"JSONRequest is a tiny Swift library for Synchronous and Asynchronous HTTP JSON request...
ruby
chosen
[ { "from": "system", "value": "Make sure git ignores nothing.\n" }, { "from": "human", "value": "require 'shellwords'\n\nmodule Kosmos\n module GitAdapter\n class << self\n def init_repo(path)\n Dir.chdir(path) do\n `git init`\n end\n end\n\n def commit_e...
ruby
chosen
[ { "from": "system", "value": "Refactor State class methods definition.\n" }, { "from": "human", "value": "module LocationsNg\n class State\n def self.all\n load_states.map{ |s| {name: s['name'], capital: s['capital']} }\n end\n\n def self.details(state)\n state = state.downca...
ruby
chosen
[ { "from": "human", "value": "Add tag to specialist sectors missing it\nThere are 19779 specialist sectors which correctly link\nto a topic but their tag field is empty.\nA user wanted to use specialist sector tags in\na CSV file to help find content but cannot\nas so many have their tags missing.\nThis adds...
ruby
chosen
[ { "from": "system", "value": "Add gift_message to the parameter whitelist\n" }, { "from": "human", "value": "module Spree\n module Core\n module ControllerHelpers\n module StrongParameters\n def permitted_attributes\n Spree::PermittedAttributes\n end\n\n de...
ruby
chosen
[ { "from": "system", "value": "Use bundle_prefix for unicorn_cmd if available\n\nCommit 7cc5272 removed mina/rails dependency, so 'bundle_prefix' could not be\nset. Use it if available, otherwise default to 'bundle exec'.\n" }, { "from": "human", "value": "require \"mina/bundler\"\nrequire \"mina...
ruby
chosen
[ { "from": "system", "value": "Add from_server (not very dry, sry)\n" }, { "from": "human", "value": "require 'mime/types'\n\nmodule Miniphonic::Helpers\n # Posts data to the server and executes a given block on success\n def to_server(url, payload = nil)\n connection = Miniphonic.connect\n\...
ruby
chosen
[ { "from": "system", "value": "Fix uninitialized constant React::JSX::Tilt in 3.2.x\n" }, { "from": "human", "value": "module React\n module JSX\n\n class Template < Tilt::Template\n self.default_mime_type = 'application/javascript'\n\n def prepare\n end\n\n def evaluate(s...
ruby
chosen
[ { "from": "system", "value": "Remove not needed abstract classes\n\nThe constructor classes are not needed for making the library work.\nSo I removed them.\n" }, { "from": "human", "value": "module Rubella\n module Input\n\n # Gets the rwa data and translate it into a by the Rubella::Weighti...
ruby
chosen
[ { "from": "system", "value": "Add Kevin to authors, add summary and description\n" }, { "from": "human", "value": "# -*- encoding: utf-8 -*-\nrequire File.expand_path('../lib/moodle2cc/version', __FILE__)\n\nGem::Specification.new do |gem|\n gem.authors = [\"Christopher Durtschi\"]\n gem...
ruby
chosen
[ { "from": "system", "value": "Upgrade Android Studio.app to v0.5.4 build-135.1101912\n" }, { "from": "human", "value": "class AndroidStudio < Cask\n url 'http://dl.google.com/dl/android/studio/ide-zips/0.5.3/android-studio-ide-135.1092050-mac.zip'\n homepage 'https://developer.android.com/sdk/...
ruby
chosen
[ { "from": "system", "value": "Update OmniFocus beta to 2.2.3\n\nThis commit freshens up the OmniFocus beta by changing the version\nto include a more recent build number, and updates the sha256\nstanza as well.\n" }, { "from": "human", "value": "cask :v1 => 'omnifocus-beta' do\n version '2.2.x-...
ruby
chosen
[ { "from": "system", "value": "Add integration tests to check for the registry endpoints.\n" }, { "from": "human", "value": "#\n# Cookbook Name:: npm_registry\n#\n# Copyright 2013 Cory Roloff\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file exce...
ruby
chosen
[ { "from": "system", "value": "Make sure that the assets are being loaded in the right order: first\nunderscore then backbone\n" }, { "from": "human", "value": "require \"test_helper\"\n\nclass InstallGeneratorTest < ::Rails::Generators::TestCase\n tests ::Backbone::InstallGenerator\n destinati...
ruby
chosen
[ { "from": "system", "value": "Add simple name parameter validation\n" }, { "from": "human", "value": "require 'rubygems'\nrequire 'sinatra'\nrequire 'sinatra/reloader'\n\nget '/' do\n\terb \"Hello! <a href=\\\"https://github.com/bootstrap-ruby/sinatra-bootstrap\\\">Original</a> pattern has been ...
ruby
chosen
[ { "from": "system", "value": "Load dependent resources, normally handled by Chef." }, { "from": "human", "value": "#\n# Copyright 2015, Noah Kantrowitz\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# Y...
ruby
chosen
[ { "from": "system", "value": "Include fuubar and simplecov in 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 'compo/version'\n\nGem::Specification.new do |spec|\n spec.name...
ruby
chosen
[ { "from": "system", "value": "Add n polygons to MultiPolygon with << operator\n" }, { "from": "human", "value": "module GeoScript\n module Geom\n JTSMultiPolygon = com.vividsolutions.jts.geom.MultiPolygon\n \n class MultiPolygon < JTSMultiPolygon\n include GeoScript::Geom\n\n ...
ruby
chosen
[ { "from": "system", "value": "Support checking if a user has completed the diagnositic.\n" }, { "from": "human", "value": "class Types::UserType < Types::BaseObject\n graphql_name 'User'\n\n field :id, ID, null: false\n field :name, String, null: false\n field :email, String, null: true\n f...
ruby
chosen
[ { "from": "human", "value": "Add complete 4.2.2 simple string\n" }, { "from": "gpt", "value": "# Solution Below\n\nold_string = \"Ruby is cool\"\nnew_string = old_string.reverse\nnew_string.upcase!\nputs \"old string: \" + old_string\nputs \"new string: \" + new_string\n\n\n# RSpec Tests. They a...
ruby
chosen
[ { "from": "system", "value": "Put a real source URL in the podspec" }, { "from": "human", "value": "Pod::Spec.new do |s|\n s.name = \"RPJSContext\"\n s.version = \"1.0.0\"\n s.summary = \"JSContext++\"\n s.homepage = \"http://github.com/RobotsAndPencils/...
ruby
chosen
[ { "from": "system", "value": "Fix name (bug -> feature)\n" }, { "from": "human", "value": "require File.join(File.dirname(__FILE__), 'helper')\n\nclass Get_bug_test < Test::Unit::TestCase\n\n def test_get_bug\n DataMapper::Logger.new(STDOUT, :debug)\n keeper = DataMapper.setup(:default,\n...
ruby
chosen
[ { "from": "system", "value": "Add optional options to simple example\n" }, { "from": "human", "value": "# encoding: utf-8\n\n$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')\nrequire 'cri'\n\ncommand = Cri::Command.define do\n name 'moo'\n usage 'usage: moo [options]'\n sum...
ruby
chosen
[ { "from": "system", "value": "Change tabs to spaces in brew bottle.\n" }, { "from": "human", "value": "# Builds binary brew package\nbrew_install\n\ndestination = HOMEBREW_PREFIX + \"Bottles\"\nif not File.directory?(destination)\n\tDir.mkdir destination\nend\n\nARGV.each do|formula|\n\t# Get th...
ruby
chosen
[ { "from": "system", "value": "Add http specific error handling.\n" }, { "from": "human", "value": "require 'httparty'\nPuppet::Type.type(:chronos_job).provide(:default) do\n\n desc \"Implements creating Chronos jobs through its REST api.\"\n\n def create\n @job = {\n 'name': resource[:na...
ruby
chosen
[ { "from": "system", "value": "Add Moneyou to the list of iDEAL issuers.\n" }, { "from": "human", "value": "# frozen_string_literal: true\n\nmodule Buckaruby\n module Ideal\n ISSUERS = {\n \"ABNANL2A\" => \"ABN AMRO\",\n \"ASNBNL21\" => \"ASN Bank\",\n \"BUNQNL2A\" => \"bunq\",...
ruby
chosen
[ { "from": "system", "value": "Add MultiJson load_json helper for future use\n" }, { "from": "human", "value": "module Bugsnag\n module Helpers\n MAX_STRING_LENGTH = 1024\n\n def self.cleanup_hash(hash)\n return nil unless hash\n hash.inject({}) do |h, (k, v)|\n h[k.to_s.g...
ruby
chosen
[ { "from": "human", "value": "Add script to build ERB templates for landing pages from YAML\n\n* I've used the NodePresenter methods to access the content from the locale\nYAML files.\n\n* If any landing page content uses interpolation this script will fail fast\nwith a `I18n::MissingInterpolationArgument` e...
ruby
chosen
[ { "from": "system", "value": "Make it actually do something.\n" }, { "from": "human", "value": "#!/usr/bin/env ruby\n\nrequire 'eventmachine'\nrequire 'date'\n\n$a = []\n\nEM.run do\n EM.add_periodic_timer(1) { $a[0] = DateTime.now.to_s }\n EM.add_periodic_timer(5) { $a[1] = File.read(\"/p...
ruby
chosen
[ { "from": "system", "value": "Fix structure dumping on Rails 4.2\n" }, { "from": "human", "value": "Rake::Task['db:structure:dump'].enhance do\n if ActiveRecord::Base.connection.table_exists?('active_record_views')\n filename = ENV['DB_STRUCTURE'] || File.join(Rails.root, \"db\", \"structure...
ruby
chosen
[ { "from": "system", "value": "Use config file for user authentication\n" }, { "from": "human", "value": "#$ ruby scratch/read_activity.rb \\\n# ~/Dropbox/GitHub-Data-Challenge-II/2013-04-12-18.json.gz | sort |\\\n# uniq -c | sort -nr\n# 1315 PushEvent\n# 251 CreateEvent\n# 109 PullReque...
ruby
chosen
[ { "from": "human", "value": "Add specs for configuration job textual_provider\n" }, { "from": "gpt", "value": "describe ConfigurationJobHelper::TextualSummary do\n include CompressedIds\n include ApplicationHelper\n\n let(:zone) { EvmSpecHelper.local_miq_server.zone }\n let(:automation_provi...
ruby
chosen
[ { "from": "human", "value": "Use ::Dir so we get ruby core's Dir, not FPM::Package::Dir\n" }, { "from": "gpt", "value": "require \"backports\" # gem backports\nrequire \"fpm/package\"\nrequire \"fpm/util\"\nrequire \"fileutils\"\nrequire \"fpm/package/dir\"\n\n# Use a zip as a package.\n#\n# Thi...
ruby
chosen
[ { "from": "system", "value": "Fix another coding issue with HAML + Rails 3 + Ruby 1.9.1\n" }, { "from": "human", "value": "module Formtastic\n module I18n\n \n DEFAULT_SCOPE = [:formtastic].freeze\n DEFAULT_VALUES = {\n :required => 'required',\n :yes => ...
ruby
chosen
[ { "from": "human", "value": "Include lib files for uploader\n" }, { "from": "gpt", "value": "require \"rest-client\"\nrequire \"github_api\"\n# We can stop requiring nokogiri when github_api is updated\nrequire \"nokogiri\"\n\nclass GithubUploader\n\n def initialize(login, username, repo, root=...
ruby
chosen
[ { "from": "system", "value": "Use module_function instead of class << self\n\nThe `Utils` module had an unnecessary extra level of indention due to\nits use of `class << self` to make its helpers all class-level\nfunctions.\n\nFix this by using the `module_function` helper, which accomplishes the\nsame thin...
ruby
chosen
[ { "from": "system", "value": "Remove inherit_resources from user questions controller\n" }, { "from": "human", "value": "class Users::QuestionsController < ApplicationController\n inherit_resources\n belongs_to :user\n\n def new\n @project = Project.find(params[:project_id])\n\n unless ...
ruby
chosen
[ { "from": "system", "value": "Fix warning for loading order in MiniTest\n" }, { "from": "human", "value": "require 'bundler/setup'\nrequire 'minitest/spec'\nrequire 'minitest/autorun'\nrequire 'active_record/like'\n\nActiveRecord::Base.establish_connection(adapter: 'sqlite3', database: ':memory:...
ruby
chosen
[ { "from": "system", "value": "Use find_each instead of each\n\nThis shouldn't load the whole result set into memory.\n" }, { "from": "human", "value": "class RequeueContent\n def initialize(scope)\n # Restrict scope to stuff that's live (published or unpublished)\n # Unpublished content w...
ruby
chosen
[ { "from": "system", "value": "Fix rule for active and inactive relations\n" }, { "from": "human", "value": "module Spree\n class Promotion\n module Rules\n class Copayment < PromotionRule\n preference :related, :integer\n\n def applicable?(promotable)\n promotabl...
ruby
chosen
[ { "from": "system", "value": "Switch to `unidecoder` gem (instead of `unidecode`)\n" }, { "from": "human", "value": "require 'unidecode'\n\n# Array extensions\nArray.class_eval do\n def arithmetic_mean\n inject(0) {|sum, n| sum + n} / length.to_f\n end\n\n def geometric_mean\n inject(1)...
ruby
chosen
[ { "from": "system", "value": "Remove completed_orders from /account response\n" }, { "from": "human", "value": "module Sprangular\n class UserSerializer < BaseSerializer\n attributes *(user_attributes | [:bill_address_id, :ship_address_id])\n\n has_many :completed_orders, serializer: Spra...
ruby
chosen
[ { "from": "system", "value": "Add maintainer and support for Travis CI.\n" }, { "from": "human", "value": "class Service::Travis < Service\n self.title = \"Travis CI\"\n default_events :push, :pull_request, :issue_comment, :public, :member\n string :user\n password :token\n string :domain\n...
ruby
chosen
[ { "from": "system", "value": "Raise error when tried to complete twice\n" }, { "from": "human", "value": "module Shotoku\n class Command\n def initialize(command)\n @command = command\n @listeners = []\n @listeners_mutex = Mutex.new\n @exitstatus, @termsig = nil, nil\n ...
ruby
chosen
[ { "from": "system", "value": "Change S3 to use HTTPS\n\niOS 7.1 requires OTA app installation links to use HTTPS – they fail otherwise." }, { "from": "human", "value": "require 'xcode/deploy/web_assets'\nrequire 'aws-sdk'\n\nmodule Xcode\n module Deploy\n \tclass S3\n \t\tdef initialize(build...
ruby
chosen
[ { "from": "system", "value": "Use application logger in set_original_heading_id\n\nThe pull request adding the original heading was done before we started\nusing `ApplicationLogger` in rake tasks.\n" }, { "from": "human", "value": "namespace :budgets do\n namespace :email do\n\n desc \"Sends...
ruby
chosen
[ { "from": "system", "value": "Drop the database, just in case. HC SVNT DRACONES.\n" }, { "from": "human", "value": "namespace :app do\n task :install do\n Rake::Task['db:seed'].invoke\n puts \"Clovrr is now installed.\"\n puts \"\\nVisit your_site/admin to get started.\"\n puts \"\\...
ruby
chosen
[ { "from": "system", "value": "Add param to force refresh of spec from disk\n" }, { "from": "human", "value": "module Tay\n module CLI\n module Helpers\n DEFAULT_TAYFILE = 'Tayfile'\n\n protected\n\n def spec\n @spec ||= get_specification\n end\n\n def get_spec...
ruby
chosen
[ { "from": "system", "value": "Store video_banner instead of a banner\n" }, { "from": "human", "value": "# encoding: utf-8\nmodule Twitchus\n class Worker\n def initialize(config_file)\n @config = Twitchus::Config.new\n @config.load(config_file)\n @checker = Twitchus::Checker.n...
ruby
chosen