Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Debug error in Circle CI
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module Quoting Name = ActiveRecord::ConnectionAdapters::PostgreSQL::Name Column = ActiveRecord::ConnectionAdapters::PostgreSQL::Column ColumnDefinition = ActiveRecord::ConnectionAdapters::ColumnDefinition ...
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module Quoting Name = ActiveRecord::ConnectionAdapters::PostgreSQL::Name Column = ActiveRecord::ConnectionAdapters::PostgreSQL::Column ColumnDefinition = ActiveRecord::ConnectionAdapters::ColumnDefinition ...
Fix example and show off the Redis engine extension
# finish with `exit` if running within `irb` require 'plezi' class ChatServer def index render 'client' end def on_open return close unless params['id'] @name = params['id'] subscribe channel: "chat" publish channel: "chat", message: "#{@name} joind the chat." write "Welcome, #{@name}!" ...
# finish with `exit` if running within `irb` require 'plezi' class ChatServer def index "Use Websockets to connect." end def on_open return close unless params['id'] @name = params['id'] subscribe channel: "chat" publish channel: "chat", message: "#{@name} joind the chat." write "Welcome, ...
Make the class of the tested factory configurable
ENV['NO_FACTORIES'] = "NO FACTORIES" require 'spec_helper' require 'spree/testing_support/factories/order_factory' RSpec.shared_examples_for 'an order factory' do it "builds" do expect(build factory).to be_a(Spree::Order) end it "creates" do expect(create factory).to be_a(Spree::Order) end end RSpec...
ENV['NO_FACTORIES'] = "NO FACTORIES" require 'spec_helper' require 'spree/testing_support/factories/order_factory' RSpec.shared_examples_for 'an order factory' do it "builds" do expect(build factory).to be_a(factory_class) end it "creates" do expect(create factory).to be_a(factory_class) end end RSp...
Index into ES after migration
class AddHarvestCountToCrop < ActiveRecord::Migration[5.2] def change change_table :crops do |t| t.integer :harvests_count, default: 0 t.integer :photo_associations_count, default: 0 end change_table :plant_parts do |t| t.integer :harvests_count, default: 0 end change_table :post...
class AddHarvestCountToCrop < ActiveRecord::Migration[5.2] def change change_table :crops do |t| t.integer :harvests_count, default: 0 t.integer :photo_associations_count, default: 0 end change_table :plant_parts do |t| t.integer :harvests_count, default: 0 end change_table :post...
Include the "default" settings and links properly.
require 'redmine' require 'update-custom-fields-commit/hooks' Redmine::Plugin.register :update_custom_fields_on_commit do name 'Update custom fields upon commit' author 'Jon McManus' url 'http://github.com/jmcb/update-custom-fields-commit' author_url 'http://githu.com/jmcb' description 'Update specific cust...
require 'redmine' require 'update-custom-fields-commit/hooks' Redmine::Plugin.register :update_custom_fields_on_commit do name 'Update custom fields upon commit' author 'Jon McManus' url 'http://github.com/jmcb/update-custom-fields-commit' author_url 'http://githu.com/jmcb' description 'Update specific cust...
Remove executables. Install interference fix
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'garager/version' Gem::Specification.new do |s| s.name = "garager" s.version = Garager::VERSION s.authors = ["Carl Zulauf"] s.email = ["carl@linkleaf.com"] s...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'garager/version' Gem::Specification.new do |s| s.name = "garager" s.version = Garager::VERSION s.authors = ["Carl Zulauf"] s.email = ["carl@linkleaf.com"] s...
Refactor create bosh release test
require 'spec_helper' describe 'create bosh release', type: :integration do it 'creates a bosh dev release successfully' do bosh_source_path = ENV['PWD'] test_dir = Dir.mktmpdir("bosh-release-test") bosh_folder_name = bosh_source_path.split('/').last err = nil Bundler.with_clean_env do crea...
require 'spec_helper' describe 'create bosh release', type: :integration do it 'creates a bosh dev release successfully' do bosh_source_path = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', '..') Dir.mktmpdir('bosh-release-test') do |test_dir| cloned_bosh_dir = File.join(test_dir, 'clo...
Patch YAML to allow only some Gem classes to be unmarshalled
# XXX: This is purely a monkey patch to close the exploit vector for now, a more # permanent solution should be pushed upstream into rubygems. require "rubygems" # Assert we're using Psych abort "Use Psych for YAML, install libyaml and reinstall ruby" unless YAML == Psych module Psych class ForbiddenClassException...
Use finder to eager-load results
module Concerns module OverallBar module Races extend ActiveSupport::Concern def find_race(discipline, category) if Discipline[:overall] == discipline event = self else event = children.detect { |e| e.discipline == discipline.name } end if ev...
module Concerns module OverallBar module Races extend ActiveSupport::Concern def find_race(discipline, category) if Discipline[:overall] == discipline event = self else event = children.detect { |e| e.discipline == discipline.name } end ::Rac...
Rename rake task namespace to redmine_recurring_tasks.
namespace :weekly_scheduler do desc 'Run issues check' task exec: :environment do date = Time.now week_day = date.strftime('%A').downcase WeeklySchedule.where("#{week_day} = true").find_each do |schedule| time_came = schedule.time.strftime('%H%M%S') <= date.strftime('%H%M%S') if time_came ...
namespace :redmine_recurring_tasks do desc 'Run issues check' task exec: :environment do date = Time.now week_day = date.strftime('%A').downcase WeeklySchedule.where("#{week_day} = true").find_each do |schedule| time_came = schedule.time.strftime('%H%M%S') <= date.strftime('%H%M%S') if tim...
Update Google App Engine Launcher to v1.9.2
class Googleappenginelauncher < Cask url 'https://commondatastorage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.1.dmg' homepage 'https://developers.google.com/appengine/' version '1.9.1' sha256 '73984bedf1f5e764aa2b6673e0e3107cd13a42d12f97b237444e7aaba321bc27' link 'GoogleAppEngineLaunc...
class Googleappenginelauncher < Cask url 'https://commondatastorage.googleapis.com/appengine-sdks/featured/GoogleAppEngineLauncher-1.9.2.dmg' homepage 'https://developers.google.com/appengine/' version '1.9.2' sha256 '0ba20e175f31c9844c660caf0faa50232400fc006be2ba63e6b769818a43a583' link 'GoogleAppEngineLaunc...
Update for use with v5.0.0 of community coookbook
# coding: utf-8 # # Cookbook Name:: rax-wordpress # Recipe:: wp-database # # Copyright 2014 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
# coding: utf-8 # # Cookbook Name:: rax-wordpress # Recipe:: wp-database # # Copyright 2014 # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
Clean the backtraces a bit more
module Protest module Utils # Small utility object to filter an error's backtrace and remove any mention # of Protest's own files. class BacktraceFilter ESCAPE_PATHS = [ # Path to the library's 'lib' dir. /^#{Regexp.escape(File.dirname(File.dirname(File.dirname(File.expand_path(__FIL...
module Protest module Utils # Small utility object to filter an error's backtrace and remove any mention # of Protest's own files. class BacktraceFilter ESCAPE_PATHS = [ # Path to the library's 'lib' dir. /^#{Regexp.escape(File.dirname(File.dirname(File.dirname(File.expand_path(__FIL...
Add a friendly password generator.
require "thor" require "jimsy/git" require "jimsy/bus_service" module Jimsy class CLI < Thor # rubocop:disable Metrics/AbcSize desc "bus", "List the next bunch of busses for a given stop" option :stop_number, default: BusService.default_stop option :services, default: BusService::DEFAULT_SERVICES, t...
require "thor" require "jimsy/git" require "jimsy/bus_service" module Jimsy class CLI < Thor # rubocop:disable Metrics/AbcSize desc "bus", "List the next bunch of busses for a given stop" option :stop_number, default: BusService.default_stop option :services, default: BusService::DEFAULT_SERVICES, t...
Add the ability to pass in template options.
require "cuba/rum" require "tilt" module Cuba class Ron < Rum def _cache Thread.current[:_cache] ||= Tilt::Cache.new end def render(template, locals = {}) _cache.fetch(template, locals) { Tilt.new(template) }.render(self, locals) end def session @session ||= env[...
require "cuba/rum" require "tilt" module Cuba class Ron < Rum def _cache Thread.current[:_cache] ||= Tilt::Cache.new end def render(template, locals = {}, options = {}) _cache.fetch(template, locals) { Tilt.new(template, 1, options) }.render(self, locals) end def sessi...
Fix a bug with 'create: true' option
module KindleManager class Client include AmazonAuth::CommonExtension attr_accessor :adapter def initialize(options = {}) @options = options @client = AmazonAuth::Client.new(@options) extend(AmazonAuth::SessionExtension) end def session @_session ||= @client.session ...
module KindleManager class Client include AmazonAuth::CommonExtension attr_accessor :adapter def initialize(options = {}) @options = options @client = AmazonAuth::Client.new(@options) extend(AmazonAuth::SessionExtension) end def session @_session ||= @client.session ...
Fix bad merge with master
# -*- encoding: utf-8 -*- lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "sidekiq/statsd/version" Gem::Specification.new do |gem| gem.name = "sidekiq-statsd" gem.version = Sidekiq::Statsd::VERSION gem.authors = ["Pablo Cantero"] g...
# -*- encoding: utf-8 -*- lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "sidekiq/statsd/version" Gem::Specification.new do |gem| gem.name = "sidekiq-statsd" gem.version = Sidekiq::Statsd::VERSION gem.authors = ["Pablo Cantero"] g...
Remove default files from rake task because they're specified in the CLI
require 'rake' require 'rake/tasklib' module YARD module Rake class YardocTask < ::Rake::TaskLib attr_accessor :name attr_accessor :options attr_accessor :files def initialize(name = :yardoc) @name = name @options = [] @files = ['lib/**/*.rb'] ...
require 'rake' require 'rake/tasklib' module YARD module Rake class YardocTask < ::Rake::TaskLib attr_accessor :name attr_accessor :options attr_accessor :files def initialize(name = :yardoc) @name = name @options = [] @files = [] yield self ...
Add rake as a dependency
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'perfecta/version' Gem::Specification.new do |gem| gem.name = "perfecta" gem.version = Perfecta::VERSION gem.authors = ["Gary Rafferty"] gem.email = ...
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'perfecta/version' Gem::Specification.new do |gem| gem.name = "perfecta" gem.version = Perfecta::VERSION gem.authors = ["Gary Rafferty"] gem.email = ...
Update gemspec for minimum griddler and mail versions
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'griddler/sendgrid/version' Gem::Specification.new do |spec| spec.name = 'griddler-sendgrid' spec.version = Griddler::Sendgrid::VERSION spec.authors = ['Caleb Thompson']...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'griddler/sendgrid/version' Gem::Specification.new do |spec| spec.name = 'griddler-sendgrid' spec.version = Griddler::Sendgrid::VERSION spec.authors = ['Caleb Thompson']...
Update indexes in SectionEdition for Mongoid 3
require "state_machine" class SectionEdition include Mongoid::Document include Mongoid::Timestamps store_in collection: "manual_section_editions" field :section_id, type: String field :version_number, type: Integer, default: 1 field :title, type: String field :slug, ...
require "state_machine" class SectionEdition include Mongoid::Document include Mongoid::Timestamps store_in collection: "manual_section_editions" field :section_id, type: String field :version_number, type: Integer, default: 1 field :title, type: String field :slug, ...
Fix migration (delete column color instead of text)
Sequel.migration do up do add_column :organizations, :color, :text Rails::Sequel.connection.run(%Q{ update organizations set color = '#227dbd' where name = 'team'; }) end down do drop_column :organizations, :text end end
Sequel.migration do up do add_column :organizations, :color, :text Rails::Sequel.connection.run(%Q{ update organizations set color = '#227dbd' where name = 'team'; }) end down do drop_column :organizations, :color end end
Fix include grammer of ruby
require 'helpers/dummy_data' module Helpers def self.included(base) base.include Dummy_data end end
require 'helpers/dummy_data' module Helpers def self.included(_base) include Dummy_data end end
Add useful methods to Hash & Array
class Hash # http://chrisholtz.com/blog/lets-make-a-ruby-hash-map-method-that-returns-a-hash-instead-of-an-array/ def hmap(&block) self.inject({}) do |hash, (k,v)| hash.merge(block.call(k, v)) end end def interpolate(ctx) self.hmap do |key, value| if value.is_a? String {key => v...
Fix country code for sweden
require "kupong_integration/version" module KupongIntegration # Your code goes here... end
require 'kupong_integration/version' require 'kupong_integration/service' module KupongIntegration # Your code goes here... end
Send specialist sectors to Rummager for Manuals
require "formatters/abstract_indexable_formatter" class ManualIndexableFormatter < AbstractIndexableFormatter def type "manual" end private def indexable_content entity.summary # Manuals don't have a body end def organisation_slugs [entity.organisation_slug] end end
require "formatters/abstract_indexable_formatter" class ManualIndexableFormatter < AbstractIndexableFormatter def type "manual" end private def extra_attributes { specialist_sectors: specialist_sectors } end def indexable_content entity.summary # Manuals don't have a body end def...
Update podspec file(Version number to 0.0.9).
Pod::Spec.new do |s| s.name = "CMRefresh" s.version = "0.0.8" s.summary = "Some util refresh categories for UIScrollView and it's subclasses." s.description = <<-DESC Some util refresh categories for UIScrollView and it's subclasses, which write in Objective-C, wish you love it, enjoy the c...
Pod::Spec.new do |s| s.name = "CMRefresh" s.version = "0.0.9" s.summary = "Some util refresh categories for UIScrollView and it's subclasses." s.description = <<-DESC Some util refresh categories for UIScrollView and it's subclasses, which write in Objective-C, wish you love it, enjoy the c...
Set pods deployment target back to 8
Pod::Spec.new do |s| s.name = "SwiftCharts" s.version = "0.5.1" s.summary = "Easy to use and highly customizable charts library for iOS" s.homepage = "https://github.com/i-schuetz/SwiftCharts" s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } s.authors = { "Ivan Schuetz" => "ivansch...
Pod::Spec.new do |s| s.name = "SwiftCharts" s.version = "0.5.1" s.summary = "Easy to use and highly customizable charts library for iOS" s.homepage = "https://github.com/i-schuetz/SwiftCharts" s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" } s.authors = { "Ivan Schuetz" => "ivansch...
Make Authentication.login input recognition more robust
module TwentyfourSevenOffice module Services class Authentication < Service wsdl "https://api.24sevenoffice.com/authenticate/v001/authenticate.asmx?wsdl" api_operation :login, input_data_types: { credential: Credential } api_operation :has_session def self.login(credentials_hash) ...
module TwentyfourSevenOffice module Services class Authentication < Service wsdl "https://api.24sevenoffice.com/authenticate/v001/authenticate.asmx?wsdl" api_operation :login, input_data_types: { credential: Credential } api_operation :has_session def self.login(credentials) if c...
Clean up DetermineOutdatedness stage a bit more
# frozen_string_literal: true module Nanoc::Int::Compiler::Stages class DetermineOutdatedness include Nanoc::Int::ContractsSupport def initialize(reps:, outdatedness_checker:, outdatedness_store:) @reps = reps @outdatedness_checker = outdatedness_checker @outdatedness_store = outdatedness_...
# frozen_string_literal: true module Nanoc::Int::Compiler::Stages class DetermineOutdatedness include Nanoc::Int::ContractsSupport def initialize(reps:, outdatedness_checker:, outdatedness_store:) @reps = reps @outdatedness_checker = outdatedness_checker @outdatedness_store = outdatedness_...
Enable request forgery protection for features
# Don't disable request forgery protection for features. We want to be sure that # authenticity_token is included in all forms which require it. ActionController::Base.allow_forgery_protection = true
Update dependency on neo4apis and bump minor version because it's easier
lib = File.expand_path('../lib/', __FILE__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) Gem::Specification.new do |s| s.name = 'neo4apis-activerecord' s.version = '0.4.1' s.required_ruby_version = '>= 1.9.1' s.authors = 'Brian Underwood' s.email = 'public@brian-underwood.codes' s.homep...
lib = File.expand_path('../lib/', __FILE__) $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) Gem::Specification.new do |s| s.name = 'neo4apis-activerecord' s.version = '0.5.0' s.required_ruby_version = '>= 1.9.1' s.authors = 'Brian Underwood' s.email = 'public@brian-underwood.codes' s.homep...
Update ignored file extension list
require 'yaml' module Watnow::Config # Default constants FOLDER_IGNORE = %w(tmp node_modules db public log) FILE_EXTENSION_IGNORE = %w(tmproj) PATTERNS = %w(TODO FIXME) def self.included(base) defaults = { 'color' => true, 'folder_ignore' => [], 'file_extension_ignore' => [], 'p...
require 'yaml' module Watnow::Config # Default constants FOLDER_IGNORE = %w(tmp node_modules db public log) FILE_EXTENSION_IGNORE = %w(tmproj markdown md txt) PATTERNS = %w(TODO FIXME) def self.included(base) defaults = { 'color' => true, 'folder_ignore' => [], 'file_extension_ignore'...
Call method directly on partner (Logic moved to partner class)
module Referrals class CaptureReferralActionService private attr_reader :referral, :amount, :info public def initialize(referral:, amount:, info:) @referral = referral @amount = amount @info = info end def call return unless partner partner.transaction do ...
module Referrals class CaptureReferralActionService private attr_reader :referral, :amount, :info public def initialize(referral:, amount:, info:) @referral = referral @amount = amount # instance of Money @info = info end def call return unless partner partner...
Fix return value when JIRA_USE_SSL is false
module Ruboty module Jira module Actions class Base < Ruboty::Actions::Base def client JIRA::Client.new( username: username, password: password, site: site, context_path: context, auth_type: :basic, use_ssl: use_ssl ) ...
module Ruboty module Jira module Actions class Base < Ruboty::Actions::Base def client JIRA::Client.new( username: username, password: password, site: site, context_path: context, auth_type: :basic, use_ssl: use_ssl ) ...
Add a route for requesting a chatpage.
Rails.application.routes.draw do resources :requests get '/login', :to => 'sessions#new', :as => :login get '/logout', :to => 'sessions#destroy', :as => :logout get "/auth/auth0/callback" => "auth0#callback" get "/auth/failure" => "auth0#failure" post "/groups/assign", to: "groups#assign" end
Rails.application.routes.draw do resources :requests get '/login', :to => 'sessions#new', :as => :login get '/logout', :to => 'sessions#destroy', :as => :logout get "/auth/auth0/callback" => "auth0#callback" get "/auth/failure" => "auth0#failure" post "/groups/assign", to: "groups#assign" end
Use the more standard dash instead of underscore in name
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails_script/version' Gem::Specification.new do |spec| spec.name = 'rails_script' spec.version = RailsScript::VERSION spec.authors = ['Kevin Pheasey'] spec.email ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rails_script/version' Gem::Specification.new do |spec| spec.name = 'rails-script' spec.version = RailsScript::VERSION spec.authors = ['Kevin Pheasey'] spec.email ...
Remove redunant reference to self.
# == Schema Information # # Table name: lots # # id :integer not null, primary key # number :integer # created_at :datetime # updated_at :datetime # street_id :integer # class Lot < ActiveRecord::Base validates :number, presence: true belongs_to :street def number_and_street "#{s...
# == Schema Information # # Table name: lots # # id :integer not null, primary key # number :integer # created_at :datetime # updated_at :datetime # street_id :integer # class Lot < ActiveRecord::Base validates :number, presence: true belongs_to :street def number_and_street "#{n...
Debug mode is off by default.
require 'readline' require 'frepl/version' require 'frepl/classifier' require 'frepl/statement' require 'frepl/fortran_file' module Frepl extend self attr_accessor :compiler, :debug def log(message) puts message if @debug end class Main class << self def run new.run end end...
require 'readline' require 'frepl/version' require 'frepl/classifier' require 'frepl/statement' require 'frepl/fortran_file' module Frepl extend self attr_accessor :compiler, :debug def log(message) puts message if @debug end class Main class << self def run new.run end end...
Update Phalcon documentation (3.0.1, 2.0.13)
module Docs class Phalcon < UrlScraper self.type = 'phalcon' self.release = '3.0.0' self.base_url = 'https://docs.phalconphp.com/en/latest/' self.root_path = 'index.html' self.links = { home: 'https://phalconphp.com/', code: 'https://github.com/phalcon/cphalcon/' } html_filter...
module Docs class Phalcon < UrlScraper self.type = 'phalcon' self.root_path = 'index.html' self.links = { home: 'https://phalconphp.com/', code: 'https://github.com/phalcon/cphalcon/' } html_filters.push 'phalcon/clean_html', 'phalcon/entries' options[:root_title] = 'Phalcon' ...
Add amf socket url to gemspec
# -*- encoding: utf-8 -*- require File.expand_path('../lib/amf_socket/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Chad Remesch"] gem.email = ["chad@remesch.com"] gem.description = %q{Ruby implementation of AMF Socket} gem.summary = %q{AMF Socket is a bi-directional...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/amf_socket/version', __FILE__) Gem::Specification.new do |gem| gem.authors = ["Chad Remesch"] gem.email = ["chad@remesch.com"] gem.description = %q{Ruby implementation of AMF Socket (https://github.com/chadrem/amf_socket)} gem.summary ...
Change config key base read into plugin
module Hookie class BasePlugin def initialize(framework) @framework = framework @config = {} @framework.config.map do |k,v| if k.start_with?("hooks.#{self.config_key}") @config[k.split(".")[2..-1].join("_").to_sym] = v end end end def log(message) ...
module Hookie class BasePlugin def initialize(framework) @framework = framework @config = {} @framework.config.map do |k,v| if k.start_with?("hookie.#{self.config_key}") @config[k.split(".")[2..-1].join("_").to_sym] = v end end end def log(message) ...
Add 'I am admin' & 'I am logged in as admin' steps.
Given /^I am registered$/ do @registered_user = Factory(:user, :email => "john@doe.com") end
Given /^I am registered$/ do @registered_user = Factory(:user, :email => "john@doe.com") end Given /^I am admin$/ do @registered_user.make_admin end Given /^I am logged in as admin$/ do steps %Q{ Given I am registered And I am admin And I am on the homepage When I follow "Sign in" And I fill...
Remove "require 'spec'" for rspec 2 compatability.
def is_ruby_19? RUBY_VERSION == '1.9.1' or RUBY_VERSION == '1.9.2' end Encoding.default_internal = Encoding.default_external = "ASCII-8BIT" if is_ruby_19? require 'rubygems' require 'spec' begin require "ruby-debug" rescue LoadError # NOP, ignore end require File.dirname(__FILE__) + '/../lib/restclient'
def is_ruby_19? RUBY_VERSION == '1.9.1' or RUBY_VERSION == '1.9.2' end Encoding.default_internal = Encoding.default_external = "ASCII-8BIT" if is_ruby_19? require 'rubygems' begin require "ruby-debug" rescue LoadError # NOP, ignore end require File.dirname(__FILE__) + '/../lib/restclient'
Update pretty print to test docstring
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') require 'pp' require 'stringio' include YARD::Parser::Ruby if RUBY19 describe YARD::Parser::Ruby::AstNode do describe "#jump" do it "should jump to the first specific inner node if found" do ast = s(:paren, s(:paren, s(:params, s...
require File.join(File.dirname(__FILE__), '..', '..', 'spec_helper') require 'pp' require 'stringio' include YARD::Parser::Ruby if RUBY19 describe YARD::Parser::Ruby::AstNode do describe "#jump" do it "should jump to the first specific inner node if found" do ast = s(:paren, s(:paren, s(:params, s...
Make measure_help? method return a boolean
module SmartAnswer::Calculators class EnergyGrantsCalculator include ActiveModel::Model attr_accessor :which_help attr_accessor :circumstances attr_accessor :date_of_birth attr_accessor :benefits_claimed attr_accessor :disabled_or_have_children attr_accessor :property_age attr_accesso...
module SmartAnswer::Calculators class EnergyGrantsCalculator include ActiveModel::Model attr_accessor :which_help attr_accessor :circumstances attr_accessor :date_of_birth attr_accessor :benefits_claimed attr_accessor :disabled_or_have_children attr_accessor :property_age attr_accesso...
Fix tiny rubocop violation in test using unless for negative condition
require 'bundler/setup' require 'fakefs/safe' require 'maxitest/autorun' module Minitest class Test # Minitest::Test#diff needs to write to the filesystem in order to produce # the nice diffs we see when a test fails. For this to work it needs to # access the real filesystem. def diff(expected, actua...
require 'bundler/setup' require 'fakefs/safe' require 'maxitest/autorun' module Minitest class Test # Minitest::Test#diff needs to write to the filesystem in order to produce # the nice diffs we see when a test fails. For this to work it needs to # access the real filesystem. def diff(expected, actua...
Comment out line where data is added to colocated charter csv - not needed anymore since CSV has already been created
def create_colocated_schools_ary(schools_hsh) colocated_addresses_w_charter = [] charters_colocation = open_csv("csv/colocated-charters-and-schools.csv") schools_hsh.each_pair do |k,v| charter_school = v.find { |x| x[3] == "Charter"} if charter_school != nil colocated_addresses_w_charter << {k => v} v.each...
def create_colocated_schools_ary(schools_hsh) colocated_addresses_w_charter = [] charters_colocation = open_csv("csv/colocated-charters-and-schools.csv") schools_hsh.each_pair do |k,v| charter_school = v.find { |x| x[3] == "Charter"} if charter_school != nil colocated_addresses_w_charter << {k => v} # v.ea...
Add tag for and_more for entries presenter
module Adminable class EntriesPresenter < BasePresenter ENTRIES_LIMIT = 5 include Enumerable extend Forwardable def_delegators :@collection, :each, :first, :last, :empty? def_delegators( *%i( @relation current_page total_pages limit_value entry_name ...
module Adminable class EntriesPresenter < BasePresenter ENTRIES_LIMIT = 5 include Enumerable extend Forwardable def_delegators :@collection, :each, :first, :last, :empty? def_delegators( *%i( @relation current_page total_pages limit_value entry_name ...
Sort of example for an alternative way of defining productions for the same rule
require File.expand_path(File.dirname(__FILE__) + "/../lib/grammoire") grammar = Grammoire.define do rule(:s) { produce(:s) + produce(:s) } rule(:s) { "(#{produce(:s)})" } rule(:s) { '()' } end 10.times { puts grammar.produce(:s) }
require File.expand_path(File.dirname(__FILE__) + "/../lib/grammoire") # Repeated rules grammar = Grammoire.define do rule(:s) { produce(:s) + produce(:s) } rule(:s) { "(#{produce(:s)})" } rule(:s) { '()' } end 10.times { puts grammar.produce(:s) + "\n\n" } # Rule with multiple options (doesn't work yet...it w...
Raise ArgumentError if properties are blank
module ReportsKit module Helper def render_report(properties, &block) if properties.is_a?(String) path = Rails.root.join('config', 'reports_kit', 'reports', "#{properties}.yml") properties = YAML.load_file(path) end builder = ReportsKit::ReportBuilder.new(properties) conten...
module ReportsKit module Helper def render_report(properties, &block) raise ArgumentError.new('`properties` must be a Hash or String') if properties.blank? if properties.is_a?(String) path = Rails.root.join('config', 'reports_kit', 'reports', "#{properties}.yml") properties = YAML.load...
Add rake task to backfill publishing_api_* dates
# @TODO Remove this file once the split dates task has run namespace :split_dates do desc "Populate the split dates introduced September 2017" task :populate, [:threads] => :environment do |_, args| threads = Integer(args.fetch(:threads, 5)) Tasks::SplitDates.populate_threaded(threads) end desc "Vali...
# @TODO Remove this file once the split dates task has run namespace :split_dates do desc "Populate the split dates introduced September 2017" task :populate, [:threads] => :environment do |_, args| threads = Integer(args.fetch(:threads, 5)) Tasks::SplitDates.populate_threaded(threads) end desc "Vali...
Use the committee factory to create councils.
require File.dirname(__FILE__) + '/../../test_helper' class Groups::MembershipsControllerTest < ActionController::TestCase def setup @user = FactoryGirl.create(:user) @group = FactoryGirl.create(:group) @group.add_user!(@user) end def test_index login_as @user assert_permission :may_list_...
require File.dirname(__FILE__) + '/../../test_helper' class Groups::MembershipsControllerTest < ActionController::TestCase def setup @user = FactoryGirl.create(:user) @group = FactoryGirl.create(:group) @group.add_user!(@user) end def test_index login_as @user assert_permission :may_list_...
Update capistrano lock to 3.7.0
lock '3.6.1' set :application, 'evemonk' set :repo_url, 'git@github.com:biow0lf/evemonk.git' set :rbenv_type, :user set :rbenv_ruby, File.read('.ruby-version').strip set :linked_files, %w(config/database.yml config/secrets.yml config/newrelic.yml) set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bu...
lock '3.7.0' set :application, 'evemonk' set :repo_url, 'git@github.com:biow0lf/evemonk.git' set :rbenv_type, :user set :rbenv_ruby, File.read('.ruby-version').strip set :linked_files, %w(config/database.yml config/secrets.yml config/newrelic.yml) set :linked_dirs, %w(bin log tmp/pids tmp/cache tmp/sockets vendor/bu...
Add method_missing definition to Buoys::Buoy
module Buoys class Buoy attr_reader :previous, :context # buoy :account do # link 'Account', account_path # end # # buoy :account_edit do |account| # link 'Account Show', show_account_path(account) # link 'Account Edit', edit_account_path(account) # pre_buoy :account # ...
module Buoys class Buoy attr_reader :previous, :context # buoy :account do # link 'Account', account_path # end # # buoy :account_edit do |account| # link 'Account Show', show_account_path(account) # link 'Account Edit', edit_account_path(account) # pre_buoy :account # ...
Fix failing DB migration for localized_names
Sequel.migration do change do alter_table :localized_names do set_column_type :value, 'varchar(2048)' end end end
Sequel.migration do up do alter_table :localized_names do set_column_type :value, 'varchar(2048)' end end down do alter_table :localized_names do set_column_type :value, 'varchar(255)' end end end
Make settings feature test timezone-safe
require 'spec_helper' feature "Settings", js: true do scenario "edit settings" do Releaf::Settings.destroy_all Releaf::Settings.register_defaults("content.updated_at" => Time.parse("2014-07-01 14:33:59 +0300"), "content.title" => "some") auth_as_user visit releaf_core_settings_path expect(page).t...
require 'spec_helper' feature "Settings", js: true do scenario "edit settings" do Releaf::Settings.destroy_all Releaf::Settings.register_defaults("content.updated_at" => Time.parse("2014-07-01 14:33:59"), "content.title" => "some") auth_as_user visit releaf_core_settings_path expect(page).to have...
Add GIF for Mac latest
cask :v1 => 'gif-for-mac' do version :latest sha256 :no_check # cloudfront.net is the official download host per the vendor homepage url 'https://d309cd6updicdi.cloudfront.net/mac/bin/GIFforMac.dmg' name 'GIF for Mac' homepage 'https://www.riffsy.com/Mac' license :gratis app 'GIF for Mac.app' end
Allow connections to 127.0.0.1 to fix acceptance tests
FakeWeb.allow_net_connect = false FakeWeb.register_uri( :delete, %r{http://localhost:9200/*}, body: { found: true, _index: "posts", _type: "post", _id: "2", _version: 5 }.to_json, content_type: "application/json; charset=UTF-8" ) FakeWeb.register_uri( :get, %r{http://localhost:9200/*}, body: { took: 2, ...
FakeWeb.allow_net_connect = false FakeWeb.register_uri( :delete, %r{http://localhost:9200/*}, body: { found: true, _index: "posts", _type: "post", _id: "2", _version: 5 }.to_json, content_type: "application/json; charset=UTF-8" ) FakeWeb.register_uri( :get, %r{http://localhost:9200/*}, body: { took: 2, ...
Update JSON gem dependency for Ruby 2.4
$LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'pg_query/version' Gem::Specification.new do |s| s.name = 'pg_query' s.version = PgQuery::VERSION s.summary = 'PostgreSQL query parsing and normalization library' s.description = 'Parses SQL queries using a copy of the PostgreSQL serv...
$LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'pg_query/version' Gem::Specification.new do |s| s.name = 'pg_query' s.version = PgQuery::VERSION s.summary = 'PostgreSQL query parsing and normalization library' s.description = 'Parses SQL queries using a copy of the PostgreSQL serv...
Test the right things in binary integration specs
# encoding: utf-8 require 'spec_helper' describe 'kafka::binary' do describe file('/opt/kafka/build') do it { should be_a_directory } it { should be_mode 755 } it { should be_owned_by('kafka') } it { should be_grouped_into('kafka') } end describe file('/tmp/kitchen-chef-solo/cache/kafka_2.8.0-0...
# encoding: utf-8 require 'spec_helper' describe 'kafka::binary' do describe file('/opt/kafka/dist') do it { should be_a_directory } it { should be_mode 755 } it { should be_owned_by('kafka') } it { should be_grouped_into('kafka') } end describe file('/tmp/kitchen-chef-solo/cache/kafka_2.8.0-0....
Set up CORS for /compile.
require 'rack/cors' require 'logger' class AppLogger < Logger alias write << end $logger = AppLogger.new(STDOUT) $logger.level = Logger::Severity::DEBUG use Rack::CommonLogger, $logger use Rack::Cors do allow do origins '*' resource '/compile/*', :headers => :any, :methods => [:post] resource '/builds...
require 'rack/cors' require 'logger' class AppLogger < Logger alias write << end $logger = AppLogger.new(STDOUT) $logger.level = Logger::Severity::DEBUG use Rack::CommonLogger, $logger use Rack::Cors do allow do origins '*' resource '/compile', :headers => :any, :methods => [:post] resource '/compile/...
Update gemspec with new version number
Gem::Specification.new do |s| s.name = "wkhtmltopdf-heroku" s.version = "2.12.2.1" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_ruby_version = '>= 1.8.7' s.authors = ["Brad Phelan"] s.date = "2015-03-19" s.description = "wkhtmltopdf b...
Gem::Specification.new do |s| s.name = "wkhtmltopdf-heroku" s.version = "2.12.2.4" s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= s.required_ruby_version = '>= 1.8.7' s.authors = ["Brad Phelan"] s.date = "2015-03-19" s.description = "wkhtmltopdf b...
Fix endless cycle problem when using script
# encoding: utf-8 require File.expand_path('../lib/code_climate_check/version', __FILE__) Gem::Specification.new do |spec| spec.name = "code_climate_check" spec.version = CodeClimateCheck::VERSION spec.authors = ["FlatStack team"] spec.summary = %q{Simple gem for checking your code w...
# encoding: utf-8 require File.expand_path('../lib/code_climate_check/version', __FILE__) Gem::Specification.new do |spec| spec.name = "code_climate_check" spec.version = CodeClimateCheck::VERSION spec.authors = ["FlatStack team"] spec.summary = %q{Simple gem for checking your code w...
Revert hardcoding of version number
# -*- encoding: utf-8 -*- # $:.push File.expand_path("../lib", __FILE__) # require "solidus_cmd/version" Gem::Specification.new do |s| s.name = "solidus_cmd" s.version = '1.0.0' s.authors = 'Solidus Team' s.email = 'contact@solidus.io' s.homepage = 'http://solidus.io' s.license ...
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require 'solidus_cmd/version' Gem::Specification.new do |s| s.name = "solidus_cmd" s.version = SolidusCmd::VERSION s.authors = 'Solidus Team' s.email = 'contact@solidus.io' s.homepage = 'http://solidus.io' s.lice...
Correct the slugs and type in the RPA migration
class RemoveRpaSpecialistSectors < Mongoid::Migration TAG_TYPE = "specialist-sector" def self.up tags_to_remove.each do |tag_id, _, _| tag = Tag.by_tag_id(tag_id, TAG_TYPE) if tag.present? if tag.destroy puts "Deleted specialist sector: #{tag_id}" else puts "Cou...
class RemoveRpaSpecialistSectors < Mongoid::Migration TAG_TYPE = "specialist_sector" def self.up tags_to_remove.each do |tag_id, _, _| tag = Tag.by_tag_id(tag_id, TAG_TYPE) if tag.present? if tag.destroy puts "Deleted specialist sector: #{tag_id}" else puts "Cou...
Use a guard clause instead of wrapping the code inside a conditional expression
require 'net/ssh' require 'stringio' def sshcmd(command, host: ENV['TESTHOST'], user: 'root', ignore_err: false) # Execute a command on the remote server # Not passing :password uses systems keys for auth out = StringIO.new err = StringIO.new Net::SSH.start(host, user, :paranoid => Net::SSH::Verifiers::Null....
require 'net/ssh' require 'stringio' def sshcmd(command, host: ENV['TESTHOST'], user: 'root', ignore_err: false) # Execute a command on the remote server # Not passing :password uses systems keys for auth out = StringIO.new err = StringIO.new Net::SSH.start(host, user, :paranoid => Net::SSH::Verifiers::Null....
Fix db:migrate after removing photo slugs
class AddSlugToPhotos < ActiveRecord::Migration def change add_column :photos, :slug, :string add_index :photos, :slug Photo.initialize_urls end end
class AddSlugToPhotos < ActiveRecord::Migration def change add_column :photos, :slug, :string add_index :photos, :slug end end
Implement a cute spinner to enhance your patience while waiting for box transitions. Show how much time it really took afterwards.
require 'rjiffy' require 'thor' require 'pp' require 'rjiffy/cli/version' require 'rjiffy/cli/base' module Rjiffy module CLI def self.start(*args) Base.start(*args) end def self.wait_for(status, &block) box = yield if box.status == status.to_s puts "Box is already #{status}"...
require 'rjiffy' require 'thor' require 'pp' require 'rjiffy/cli/version' require 'rjiffy/cli/base' module Rjiffy module CLI SPINNER_CHARS = [].tap do |chars| chars << '⠈⠑' chars << ' ⠱' chars << ' ⡰' chars << '⢀⡠' chars << '⢄⡀' chars << '⢆ ' chars << '⠎ ' chars ...
Fix bad require in the recipe
require "chef-sugar" if Gem::Requirement.new(">= 12.10.48").satisfied_by?(Gem::Version.new(Chef::VERSION))
require "chef/sugar" if Gem::Requirement.new(">= 12.10.48").satisfied_by?(Gem::Version.new(Chef::VERSION))
Allow flag to not be in config
CONTINUE_ON_FAILED_REGISTRATION_RPS = RP_CONFIG.fetch('allow_continue_on_failed_registration')
CONTINUE_ON_FAILED_REGISTRATION_RPS = RP_CONFIG.fetch('allow_continue_on_failed_registration', ifnone: [])
Fix bug - Swing Timer defaults to repeating.
class Gui::EventQueue include Singleton import 'javax.swing.SwingUtilities' import 'javax.swing.Timer' def sync_exec(&callback) SwingUtilities.invokeAndWait(&callback) end def future_exec(seconds = 0, &callback) if seconds <= 0 SwingUtilities.invokeLater(&callback) else Timer.ne...
class Gui::EventQueue include Singleton import 'javax.swing.SwingUtilities' import 'javax.swing.Timer' def sync_exec(&callback) SwingUtilities.invokeAndWait(&callback) end def future_exec(seconds = 0, &callback) if seconds <= 0 SwingUtilities.invokeLater(&callback) else Timer.ne...
Make Engines::FastJaccardSimilarity a default engine
module Likes # Job: Understands patterns in people likings class Set # Default engine - simplest one # # @see Engines::BestIntersectionSize DEFAULT_ENGINE = Engines::BestIntersectionSize # Creates new instance of Set # # @param [Array<Like>] likes List of likes # @param [Engines::Pr...
module Likes # Job: Understands patterns in people likings class Set # Default engine - simplest one # # @see Engines::FastJaccardSimilarity DEFAULT_ENGINE = Engines::FastJaccardSimilarity # Creates new instance of Set # # @param [Array<Like>] likes List of likes # @param [Engines::...
Test script for integration with ZohoProjects
require File.expand_path('../helper', __FILE__) class ZohoProjectsTest < Service::TestCase def setup @stubs = Faraday::Adapter::Test::Stubs.new end def data { "project_id" => "1234", "token" => "a13d", } end def test_push url = "/serviceHook" @stubs.post url do |env| ...
Allow iframes to use the button -This removes restrictions that set X-Frame-Options to ‘SAMEORIGIN’.
class HelloWorldApp < Sinatra::Base get '/' do "Hello, world!" end get '/button' do @color = params[:color] @username = params[:username] erb :button end end
class HelloWorldApp < Sinatra::Base configure do set :protection, :except => :frame_options end get '/' do "Hello, world!" end get '/button' do @color = params[:color] @username = params[:username] erb :button end end
Add license details to gemspec.
# -*- encoding: utf-8 -*- require File.expand_path('../lib/ffi-proj4/version', __FILE__) Gem::Specification.new do |s| s.name = "ffi-proj4" s.version = Proj4::VERSION s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["J Smith"] s.descrip...
# -*- encoding: utf-8 -*- require File.expand_path('../lib/ffi-proj4/version', __FILE__) Gem::Specification.new do |s| s.name = "ffi-proj4" s.version = Proj4::VERSION s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= s.authors = ["J Smith"] s.descrip...
Fix indentation. Workshops to Workshop.
class ChangePhaseToInt < ActiveRecord::Migration def change Workshops.find_each do |workshop| phase = workshop.phase new_phase = 0 if phase == 'Phase 1' new_phase = 1 elsif phase == 'Phase 2' new_phase = 2 elsif phase == 'Phase 2 Online' new_phase = 3 elsif pha...
class ChangePhaseToInt < ActiveRecord::Migration def change Workshop.find_each do |workshop| phase = workshop.phase new_phase = 0 if phase == 'Phase 1' new_phase = 1 elsif phase == 'Phase 2' new_phase = 2 elsif phase == 'Phase 2 Online' new_phase = 3 els...
Bump pod version to 1.0.0
Pod::Spec.new do |spec| spec.name = "DelaunaySwift" spec.version = "0.1.2" spec.summary = "A utility for doing Delaunay triangulations on a set of vertices." spec.source = { :git => "https://github.com/AlexLittlejohn/DelaunaySwift.git", :tag => spec.version.to_s }...
Pod::Spec.new do |spec| spec.name = "DelaunaySwift" spec.version = "1.0.0" spec.summary = "A utility for doing Delaunay triangulations on a set of vertices." spec.source = { :git => "https://github.com/AlexLittlejohn/DelaunaySwift.git", :tag => spec.version.to_s }...
Fix to last commit, split in the wrong place
module Eshealth class ClusterConfig < Checkfactory attr_accessor :url, :configbody, :type, :lastmsg attr_reader :requestfactory def initialize(options={}) self.type = "ClusterConfig" self.url = options[:url] || "http://localhost:9200" self.requestfactory = options[:requestfactory]...
module Eshealth class ClusterConfig < Checkfactory attr_accessor :url, :configbody, :type, :lastmsg attr_reader :requestfactory def initialize(options={}) self.type = "ClusterConfig" self.url = options[:url] || "http://localhost:9200" self.requestfactory = options[:requestfactory]...
Add another MacRuby extension to the URL class
framework 'Foundation' # work around curb not building for MacRuby (ticket #941) Handsoap.http_driver = :net_http class URL def initialize(url_string) @url = NSURL.URLWithString url_string end end module JIRA #overrides for MacRuby end
framework 'Foundation' # work around curb not building for MacRuby (ticket #941) Handsoap.http_driver = :net_http class URL def initialize(url_string) @url = NSURL.URLWithString url_string end alias_method absoluteString to_s end module JIRA #overrides for MacRuby end
Refactor as class, add setup, and remove cruft
module BenchTool # A structureless datastore; loads and persists to a YML file in a configured location module AppConfig CONFIG_DIR = File.expand_path('./config') CONFIG_FILE = 'configuration.yml' CONFIG_PATH = File.join(CONFIG_DIR, CONFIG_FILE) @@options = {} # Load config def self.l...
module BenchTool # A structureless datastore; loads and persists to a YML file in a configured location class AppConfig CONFIG_DIR = File.expand_path('./config') CONFIG_FILE = 'configuration.yml' CONFIG_PATH = File.join(CONFIG_DIR, CONFIG_FILE) APP_CONFIG_DIR = File.expand_path(File.dirname(__FILE_...
Format date-time into ISO 8601
module Quickbooks module Service class CDC < BaseService def url_for_cdc(models, start_time) entities = models.map {|model| model::XML_NODE}.join(',') changedSince = start_time.iso8601 "#{url_for_base}/cdc?entities=#{entities}&changedSince=#{changedSince}" end def...
module Quickbooks module Service class CDC < BaseService def url_for_cdc(models, start_time) entities = models.map {|model| model::XML_NODE}.join(',') changedSince = start_time.iso8601 "#{url_for_base}/cdc?entities=#{entities}&changedSince=#{changedSince}" end def...
Add a homepage to the gemspec
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "digest-cksum" s.summary = "Unix cksum implementation" s.author = "Mal Clrambault" s.email = "mael@clerambault.fr" s.files = %w(lib/digest/cksum.rb) s.version = "0.1" end
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "digest-cksum" s.summary = "Unix cksum implementation" s.author = "Mal Clrambault" s.email = "mael@clerambault.fr" s.homepage = "http://github.com/hanklords/digest-cksum" s.files = %w(lib/digest/cksum.rb) s.version = "0.1" end
Add filtering by tag logic to stories import
class ImportStories require 'rss' require 'open-uri' def call(reset = false) cleanup if reset import_stories end private def cleanup Story.delete_all end def import_stories existing = Story.count url = 'http://www.wri.org/blog/rss2.xml' rss = open(url) feed = RSS::Parser...
class ImportStories require 'rss' require 'open-uri' def call(reset = false) cleanup if reset import_stories end private def cleanup Story.delete_all end def filterByTag tags allowedTags = ["climatewatch", "ndcsdg", "esp", "ndc"] return tags if allowedTags.any? { |allowedTag| ta...
Use march_hare in these names
RSpec.describe "Any exchange" do let(:connection) { MarchHare.connect } after :each do connection.close end # # Examples # it "can have an alternate exchange (a RabbitMQ-specific extension to AMQP 0.9.1)" do ch = connection.create_channel q = ch.queue("", :exclusive => true) fe = ch....
RSpec.describe "Any exchange" do let(:connection) { MarchHare.connect } after :each do connection.close end # # Examples # it "can have an alternate exchange (a RabbitMQ-specific extension to AMQP 0.9.1)" do ch = connection.create_channel q = ch.queue("", :exclusive => true) fe = ch....
Update HandbrakeCLI Nightly to v6562svn
cask :v1 => 'handbrakecli-nightly' do version '6559svn' sha256 'b66feea96cb15ab7f54498235670ead24245af51e339b7218eabc58446692e17' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'http://handbrake.fr' license :gpl binary 'HandBrakeCLI' end
cask :v1 => 'handbrakecli-nightly' do version '6562svn' sha256 'fb93b620e1b106695183fd507c445da209351773c7719ef4144e9957cdbd5c86' url "http://download.handbrake.fr/nightly/HandBrake-#{version}-MacOSX.6_CLI_x86_64.dmg" homepage 'http://handbrake.fr' license :gpl binary 'HandBrakeCLI' end
Fix Validation for Account Subdomain
class Account < ActiveRecord::Base has_many :users, dependent: :destroy has_many :invoices, dependent: :destroy has_many :positions, through: :invoices has_many :customers, dependent: :destroy has_many :projects, through: :customers has_many :tasks, through: :projects has_many :timers, through: :tasks ...
class Account < ActiveRecord::Base has_many :users, dependent: :destroy has_many :invoices, dependent: :destroy has_many :positions, through: :invoices has_many :customers, dependent: :destroy has_many :projects, through: :customers has_many :tasks, through: :projects has_many :timers, through: :tasks ...
Remove --main rdoc thing from gemspec.
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{weakling} s.version = "0.0.1" s.authors = ["Charles Oliver Nutter"] s.date = Time.now.strftime('YYYY-MM-DD') s.description = "A modified WeakRef impl for JRuby plus some weakref-related tools" s.email = ["headius@headius.com"] s.files = ...
# -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = %q{weakling} s.version = "0.0.1" s.authors = ["Charles Oliver Nutter"] s.date = Time.now.strftime('YYYY-MM-DD') s.description = "A modified WeakRef impl for JRuby plus some weakref-related tools" s.email = ["headius@headius.com"] s.files = ...
Improve plugin description; Fix pathes, controller names and permissions.
require 'redmine' Redmine::Plugin.register :redmine_dashboard do name 'Redmine Dashboard plugin' author 'Jan Graichen' description 'Add a task dashboard to Redmine' version '2.0.dev' url 'https://github.com/jgraichen/redmine_dashboard' author_url 'mailto:jg@altimos.de' project_module :dashboard do p...
require 'redmine' Redmine::Plugin.register :redmine_dashboard do name 'Redmine Dashboard plugin' author 'Jan Graichen' description 'Add a task board and a planning board to Redmine' version '2.0.dev' url 'https://github.com/jgraichen/redmine_dashboard' author_url 'mailto:jg@altimos.de' project_module :d...
Remove validations if nonce presence
module PiggybakBraintree module PaymentDecorator extend ActiveSupport::Concern included do attr_accessor :payment_method_nonce validates :payment_method_nonce, presence: true validates :month, presence: true, unless: :payment_method_nonce validates :year, presence: true, unless: :pay...
module PiggybakBraintree module PaymentDecorator extend ActiveSupport::Concern included do attr_accessor :payment_method_nonce validates :payment_method_nonce, presence: true [:month, :year].each do |field| _validators.reject!{ |key, _| key == field } _validate_callbacks....
Refactor to not use $- variable
# This program outputs the Fibonacci sequence for as long # as it can using the closed-form expression of the series. $_ = $$ / $$ # 1 @_ = $_ + $_ # 2 $- = $_ - @_ # -1 $__= @_ * @_ + $_ # 5 @__= $__ ** (@_ ** $-) # sqrt(5) $___ = ($_ + @__) / @_ # golden ratio @___ = ($_ / -$___) # negative reciprocal $. = $_...
# This program outputs the Fibonacci sequence for as long # as it can using the closed-form expression of the series. $_ = $$ / $$ # 1 @_ = $_ + $_ # 2 $-_ = $_ - @_ # -1 $__= @_ * @_ + $_ # 5 @__= $__ ** (@_ ** $-_) # sqrt(5) $___ = ($_ + @__) / @_ # golden ratio @___ = ($_ / -$___) # negative reciprocal $. = ...
Fix dependencies in acceptance tests
require 'spec_helper_acceptance' describe 'freeradius::mod' do context 'when running puppet code' do pp = <<-EOF class { 'freeradius': } freeradius::mod { 'perl': ensure => present, package => 'freeradius-perl', content => 'perl { filename = ${modconfdir}/${.:instan...
require 'spec_helper_acceptance' describe 'freeradius::mod' do context 'when running puppet code' do pp = <<-EOF class { 'freeradius': } freeradius::mod { 'perl': ensure => present, package => 'freeradius-perl', content => 'perl { filename = ${modconfdir}/${.:instan...
Use camelCase in JBuilder output
# Load the Rails application. require File.expand_path('../application', __FILE__) # Initialize the Rails application. Rails.application.initialize!
# Load the Rails application. require File.expand_path('../application', __FILE__) Jbuilder.key_format camelize: :lower # Initialize the Rails application. Rails.application.initialize!
Replace method_missing with explicit methods
module Onfido class API def initialize(options = {}) @api_key = options[:api_key] end def method_missing(method, *args) klass = method.to_s.split('_').collect(&:capitalize).join Object.const_get("Onfido::#{klass}").new(@api_key) rescue NameError super end def respond_...
module Onfido class API def initialize(options = {}) @api_key = options[:api_key] end def applicant Onfido::Applicant.new(@api_key) end def check Onfido::Check.new(@api_key) end def document Onfido::Document.new(@api_key) end def live_photo Onfido:...
Add json endpoint for users
class Users::ProfilesController < Devise::SessionsController # before_filter :configure_sign_in_params, only: [:create] def show @user = User.find(params[:id]) render :'devise/profiles/show' ## possible refactor end # GET /resource/sign_in # def new # super # end # POST /resource/sign_in # d...
class Users::ProfilesController < Devise::SessionsController # before_filter :configure_sign_in_params, only: [:create] respond_to :json, :html def show @user = User.find(params[:id]) render json: @user # render :'devise/profiles/show' ## possible refactor end # GET /resource/sign_in # def ...
Replace implicit SQL literal in filter method.
module Sequel module Plugins module PgTrgm module DatasetMethods def text_search(column, query) where("? % ?", column, query).reverse_order{ similarity(column, query) } end end end end end
module Sequel module Plugins module PgTrgm module DatasetMethods def text_search(column, query) where(Sequel.lit('? % ?', column, query)).reverse_order{ similarity(column, query) } end end end end end
Make cap task db2local more robust and verbose
desc 'Copy database from the server to your local database' task db2local: ['deploy:set_rails_env'] do on roles(:app) do within current_path do filename = nil info 'Creating DB export' with rails_env: fetch(:rails_env) do filename = capture(:rake, 'db:dump_sql').strip end ...
def system_v(cmd) info "Execute '#{cmd}'" system cmd end desc 'Copy database from the server to your local database' task db2local: ['deploy:set_rails_env'] do on roles(:app) do within current_path do filename = nil info 'Creating DB export' with rails_env: fetch(:rails_env) do fi...
Fix parsing and decoding of UTF-16 layer name.
require_relative '../layer_info' class PSD class UnicodeName < LayerInfo @key = 'luni' def parse pos = @file.tell len = @file.read_int * 2 @data = @file.read(len).unpack("A#{len}")[0].encode('UTF-8').delete("\000") # The name seems to be padded with null bytes. This is the easiest s...
require_relative '../layer_info' class PSD class UnicodeName < LayerInfo @key = 'luni' def parse pos = @file.tell @data = @file.read_unicode_string # The name seems to be padded with null bytes. This is the easiest solution. @file.seek pos + @length return self end end ...
Add development dependency on json-schema
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'csv_to_popolo/version' Gem::Specification.new do |spec| spec.name = "csv_to_popolo" spec.version = Popolo_CSV::VERSION spec.authors = ["Tony Bowden"] spec.email ...
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'csv_to_popolo/version' Gem::Specification.new do |spec| spec.name = "csv_to_popolo" spec.version = Popolo_CSV::VERSION spec.authors = ["Tony Bowden"] spec.email ...
Use git existing files to build gem files manifest
Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.require_paths = ['lib'] s.rubygems_version = '1.3.7' s.name = 'tiny_tds' s.summary = 'TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.' s.description = 'TinyTDS - A modern, simple and fast FreeTDS library for Ruby...
Gem::Specification.new do |s| s.platform = Gem::Platform::RUBY s.require_paths = ['lib'] s.rubygems_version = '1.3.7' s.name = 'tiny_tds' s.summary = 'TinyTDS - A modern, simple and fast FreeTDS library for Ruby using DB-Library.' s.description = 'TinyTDS - A modern, simple and fast FreeTDS library for Ruby...