Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Change redirect after sign up for FB | module SimpleUser
class AuthController < ApplicationController
def create
auth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider_and_uid(auth['provider'], auth['uid'])
if authentication
flash[:notice] = "Signed in successfully."
sign_in(:us... | module SimpleUser
class AuthController < ApplicationController
before_filter :set_user_return_to
def set_user_return_to
url = request.referer
namespace_name = url.split('/')[3] rescue ""
if namespace_name != "simple_user"
session[:return_to] = request.referer
end
end
... |
Add tests for new auth tokens | require "test_helper"
class AuthTokenTest < ActiveSupport::TestCase
def test_token_is_unique
# Create a token...
user = FactoryBot.create(:user)
token = user.generate_authentication_token!
# Try to duplicate
t1 = AuthToken.new(user_id: user.id, authentication_token: token.authentication_token, a... | |
Complete box handler spec coverage | require 'test_helper'
require 'minitest/autorun'
require "matrix"
describe "sudokuru_unit_box_handler" do
it "should replace non erroneous box values with blanks" do
load "././app/box_handler.rb"
box_map = Matrix.identity(3)
puzzle = Matrix.zero(3)
box_handler = BoxHandler.new(puzzle, box_map)
v... | |
Add integration tests for index groups. | require "integration_test_helper"
require "rest-client"
require "cgi"
class ElasticsearchIndexGroupTest < IntegrationTest
def setup
@group_name = "rummager_test"
stub_elasticsearch_settings [@group_name]
enable_test_index_connections
try_remove_test_index
@index_group = search_server.index_grou... | |
Fix for mingw32 and single quotes. | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'headless_html_editor/version'
Gem::Specification.new do |spec|
spec.name = "headless_html_editor"
spec.version = HeadlessHtmlEditor::VERSION
spec.authors = ["Bo Frederi... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'headless_html_editor/version'
Gem::Specification.new do |spec|
spec.name = 'headless_html_editor'
spec.version = HeadlessHtmlEditor::VERSION
spec.authors = ['Bo Frederi... |
Fix `url` stanza comment for ViMediaManager. | cask 'vimediamanager' do
version '0.7a14c'
sha256 '2fb3dc8b5d2c5ab40a34e18c0860da98d1b92bac673f8a134bfca82cf013714a'
url "http://mariusth.channelwood.org/vimediamanager/files/vimediamanager_v#{version}.dmg"
appcast 'http://mariusth.heliohost.org/vimediamanager/appcast-cocoa.xml',
checkpoint: '432abec... | cask 'vimediamanager' do
version '0.7a14c'
sha256 '2fb3dc8b5d2c5ab40a34e18c0860da98d1b92bac673f8a134bfca82cf013714a'
# mariusth.channelwood.org was verified as official when first introduced to the cask
url "http://mariusth.channelwood.org/vimediamanager/files/vimediamanager_v#{version}.dmg"
appcast 'http://... |
Use mocha/setup in place of deprecated mocha | require "minitest/autorun"
require File.expand_path("../../../lib/test/enumerable_assertions", __FILE__)
require "active_support/core_ext/object/blank"
require "active_support/core_ext/object/try"
require "active_support/concern"
require "mocha"
module Ruby
class TestCase < MiniTest::Unit::TestCase
include Test:... | require "minitest/autorun"
require File.expand_path("../../../lib/test/enumerable_assertions", __FILE__)
require "active_support/core_ext/object/blank"
require "active_support/core_ext/object/try"
require "active_support/concern"
require "mocha/setup"
module Ruby
class TestCase < MiniTest::Unit::TestCase
include... |
Create user through GUI instead of using FactoryGirl because that way wasn't working | module LoginHelper
def ensure_logged_out
if page.has_link? 'LOGOUT'
click_link 'LOGOUT'
end
end
end
| module LoginHelper
def ensure_logged_out
if page.has_link? 'LOGOUT'
click_link 'LOGOUT'
end
end
def create_user_through_gui
visit '/users/new'
fill_in 'user_name', with: 'foobarbaz'
fill_in 'user_password', with: 'foobarbaz'
fill_in 'user_password_confirmation', with: 'foobarbaz'
... |
Test for fundamental API deserialization errors | # coding: utf-8
require 'net/http'
require 'spec_helper'
RSpec.feature "JSON argument deserialization", type: :request do
let(:evaluate_json_uri) { URI.join(Capybara.app_host, '/evaluate.json') }
context "when the JSON data is malformed" do
let(:body) { JSON.generate({}) }
it "responds with a JSON error... | |
Build D-Bus without X dependency. | require 'formula'
class DBus <Formula
url 'http://dbus.freedesktop.org/releases/dbus/dbus-1.2.16.tar.gz'
homepage 'http://www.freedesktop.org/wiki/Software/dbus'
md5 'c7a47b851ebe02f6726b65b78d1b730b'
aka 'dbus'
# Don't clean the empty directories that D-Bus needs
skip_clean "etc/dbus-1/session.d"
skip... | require 'formula'
class DBus <Formula
url 'http://dbus.freedesktop.org/releases/dbus/dbus-1.2.16.tar.gz'
homepage 'http://www.freedesktop.org/wiki/Software/dbus'
md5 'c7a47b851ebe02f6726b65b78d1b730b'
aka 'dbus'
# Don't clean the empty directories that D-Bus needs
skip_clean "etc/dbus-1/session.d"
skip... |
Use more explicit Registry self.method definitions | module Restforce
module DB
# Restforce::DB::Registry is responsible for keeping track of all mappings
# established in the system.
class Registry
class << self
include Enumerable
attr_accessor :collection
# Public: Get the Restforce::DB::Mapping entry for the specified m... | module Restforce
module DB
# Restforce::DB::Registry is responsible for keeping track of all mappings
# established in the system.
class Registry
extend Enumerable
# Public: Get the Restforce::DB::Mapping entry for the specified model.
#
# model - A String or Class.
#
... |
Update license reference in podspec | Pod::Spec.new do |s|
s.name = "OmniBase"
s.version = "0.1.0"
s.summary = "The core Omni open source framework."
s.homepage = "https://github.com/wjk/OmniBase"
s.license = { :type => 'OMNI', :file => 'OmniSourceLicense.html' }
s.author = { "William Ken... | Pod::Spec.new do |s|
s.name = "OmniBase"
s.version = "0.1.0"
s.summary = "The core Omni open source framework."
s.homepage = "https://github.com/wjk/OmniBase"
s.license = { :type => 'Omni', :file => 'LICENSE' }
s.author = { "William Kent" => "https://... |
Rename applied_schedule_exceptions link to applied_exceptions. | require 'roar/json/json_api'
class EventRepresenter < Roar::Decorator
include Roar::JSON::JSONAPI
type :events
property :id, render_nil: true
property :name, render_nil: true
property :note
property :relative_sequence_number, as: :sequence_number
property :starts_at, render_nil: true
property :ends_at... | require 'roar/json/json_api'
class EventRepresenter < Roar::Decorator
include Roar::JSON::JSONAPI
type :events
property :id, render_nil: true
property :name, render_nil: true
property :note
property :relative_sequence_number, as: :sequence_number
property :starts_at, render_nil: true
property :ends_at... |
Update Dwarf Fortress to 0.40.12 | class DwarfFortress < Cask
version '0.40.01'
sha256 'c4f729f094790671b1fde995c02c5d547d652d87790785b13a6cdc9f35dec6be'
url 'http://www.bay12games.com/dwarves/df_40_01_osx.tar.bz2'
homepage 'http://www.bay12games.com/dwarves/'
link 'df_osx/df', :target => 'Dwarf Fortress/df'
end
| class DwarfFortress < Cask
version '0.40.12'
sha256 'e493942db5553a33ac38a150ea16dfb9748192a3f7c1961a342a7436f64cc6c0'
url 'http://www.bay12games.com/dwarves/df_40_12_osx.tar.bz2'
homepage 'http://www.bay12games.com/dwarves/'
link 'df_osx/df', :target => 'Dwarf Fortress/df'
end
|
Change tired code to be broke not | require 'rubygems'
require 'bundler/setup'
require 'haml'
require 'sinatra'
require 'redis'
redis = Redis.new(:url => ENV["REDIS_URL"])
configure do
set :views, File.join(File.dirname(__FILE__), "views")
end
get '/' do
haml :root
end
post '/' do
if redis.sismember("EMAIL", params[:username])
haml :bad
el... | require 'rubygems'
require 'bundler/setup'
require 'haml'
require 'sinatra'
require 'redis'
redis = Redis.new(:url => ENV["REDIS_URL"])
configure do
set :views, File.join(File.dirname(__FILE__), "views")
end
get '/' do
haml :root
end
post '/' do
if redis.sismember("EMAIL", params[:email])
haml :bad
else
... |
Fix issue with older versions of Ruby and URI. | # frozen_string_literal: true
require "spec_helper"
describe Bundler::Fetcher::CompactIndex do
let(:downloader) { double(:downloader) }
let(:remote) { double(:remote, :cache_slug => "lsjdf") }
let(:display_uri) { URI("http://sample_uri.com") }
let(:compact_index) { described_class.new(downloader, remote,... | # frozen_string_literal: true
require "spec_helper"
describe Bundler::Fetcher::CompactIndex do
let(:downloader) { double(:downloader) }
let(:remote) { double(:remote, :cache_slug => "lsjdf") }
let(:display_uri) { URI("http://sampleuri.com") }
let(:compact_index) { described_class.new(downloader, remote, ... |
Fix failling spec due to the elasticsearch formula update | require "spec_helper"
describe "elasticsearch::package" do
let(:facts) { default_test_facts }
it do
should contain_homebrew__formula("elasticsearch")
should contain_package("boxen/brews/elasticsearch").with_ensure("0.90.5-boxen1")
end
end
| require "spec_helper"
describe "elasticsearch::package" do
let(:facts) { default_test_facts }
it do
should contain_homebrew__formula("elasticsearch")
should contain_package("boxen/brews/elasticsearch").with_ensure("1.1.1-boxen1")
end
end
|
Change code so it is case insensitive | require "pig_latin/version"
module PigLatin
# Your code goes here...
def self.cut_front(word)
if /\A[aeiou]/.match(word) != nil
return "w"
elsif /\Ay/.match(word).to_s == "y" || /y/.match(word) == nil
/[^aeiou]+/.match(word).to_s
else
/[^aeiouy]+/.match(word).to_s
end
end
def... | require "pig_latin/version"
module PigLatin
# Your code goes here...
def self.cut_front(word)
if /\A[aeiou]/i.match(word) != nil
return "w"
elsif /\Ay/i.match(word).to_s == "y" || /y/i.match(word) == nil
/[^aeiou]+/i.match(word).to_s
else
/[^aeiouy]+/i.match(word).to_s
end
end
... |
Check all data in Array. Change message | require 'json'
require 'jsonpath'
module Embulk
module Guess
class Jsonpath < TextGuessPlugin
Plugin.register_guess("jsonpath", self)
def guess_text(config, sample_text)
parser_config = config.param("parser",:hash)
json_path = parser_config.param("root",:string,default: "$")
... | require 'json'
require 'jsonpath'
module Embulk
module Guess
class Jsonpath < TextGuessPlugin
Plugin.register_guess("jsonpath", self)
def guess_text(config, sample_text)
parser_config = config.param("parser",:hash)
json_path = parser_config.param("root",:string,default: "$")
... |
Remove installation of nfs-kernel-server for debian | #
# Cookbook Name:: nfs
# Recipe:: _idmap
#
# Copyright 2014, Eric G. Wolfe
#
# 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
#
# Unless requi... | #
# Cookbook Name:: nfs
# Recipe:: _idmap
#
# Copyright 2014, Eric G. Wolfe
#
# 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
#
# Unless requi... |
Fix the execute resource in streamingcollection | #
# Cookbook Name:: wt_streamingcollection
# Recipe:: default
#
# Copyright 2012, Webtrends
#
# All rights reserved - Do Not Redistribute
#
user = node[:user]
group = node[:group]
tarball = node[:tarball]
log_dir = "#{node['wt_common']['log_dir_linux']}/streamingcollection"
install_dir = "#{n... | #
# Cookbook Name:: wt_streamingcollection
# Recipe:: default
#
# Copyright 2012, Webtrends
#
# All rights reserved - Do Not Redistribute
#
user = node[:user]
group = node[:group]
tarball = node[:tarball]
log_dir = "#{node['wt_common']['log_dir_linux']}/streamingcollection"
install_dir = "#{n... |
Update sniff dependency to 1.x | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "automobile/version"
Gem::Specification.new do |s|
s.name = "automobile"
s.version = BrighterPlanet::Automobile::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Derek Kastner', 'Seamus Abshere', 'Andy Rossmeissl', 'Ian Hough'... | # -*- encoding: utf-8 -*-
$:.push File.expand_path("../lib", __FILE__)
require "automobile/version"
Gem::Specification.new do |s|
s.name = "automobile"
s.version = BrighterPlanet::Automobile::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Derek Kastner', 'Seamus Abshere', 'Andy Rossmeissl', 'Ian Hough'... |
Fix elfinder error on rails5 | class Wor::ElfinderController < ApplicationController
layout 'elfinder'
def index
end
def elfinder
h, r = ElFinder::Connector.new(
:root => File.join(Rails.public_path, 'wor', 'uploads'),
:url => '/wor/uploads',
:perms => {
'forbidden' => {:read => false, :write => false, :rm => ... | class Wor::ElfinderController < ApplicationController
layout 'elfinder'
def index
end
def elfinder
h, r = ElFinder::Connector.new(
:root => File.join(Rails.public_path, 'wor', 'uploads'),
:url => '/wor/uploads',
:perms => {
'forbidden' => {:read => false, :write => false, :rm => ... |
Bring the spec into the 21st century | Gem::Specification.new do |s|
s.name = "jekyll-sitemap"
s.summary = "Automatically generate a sitemap.xml for your Jekyll site."
s.version = "0.4.1"
s.authors = ["GitHub, Inc."]
s.email = "support@github.com"
s.homepage = "https://github.com/github/jekyll-sitemap"
s.licenses ... | s.version = "0.4.1"
# coding: utf-8
Gem::Specification.new do |spec|
spec.name = "jekyll-sitemap"
spec.summary = "Automatically generate a sitemap.xml for your Jekyll site."
spec.authors = ["GitHub, Inc."]
spec.email = "support@github.com"
spec.homepage = "https://github.com/jek... |
Remove useless header from Space API response | class SpaceApiController < ApplicationController
before_action :set_access_control_headers, only: :status
def status
@space_api = SpaceApi.new
end
private
def set_access_control_headers
if request.format.json?
response.headers['Access-Control-Allow-Origin'] = '*'
response.heade... | class SpaceApiController < ApplicationController
before_action :set_access_control_headers, only: :status
def status
@space_api = SpaceApi.new
end
private
def set_access_control_headers
if request.format.json?
response.headers['Access-Control-Allow-Origin'] = '*'
end
end
end
|
Package version is increased from 0.8.1.0 to 0.9.0.0 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
s.version = '0.8.1.0'
s.summary = 'Messaging primitives for Eventide'
s.description = ' '
s.authors = ['The Eventide Project']
s.email = 'opensource@eventide-project.org'
s.homepage = 'https://github.com/eventide-project/mes... | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'evt-messaging'
s.version = '0.9.0.0'
s.summary = 'Messaging primitives for Eventide'
s.description = ' '
s.authors = ['The Eventide Project']
s.email = 'opensource@eventide-project.org'
s.homepage = 'https://github.com/eventide-project/mes... |
Change method name for a more Ruby one | module RandomLocation
extend self
METERS_IN_DEGREE = 111_300
def nearby(lat, lng, r)
u = rand
v = rand
# Convert radius from meters to degrees
radius = r.to_f / METERS_IN_DEGREE
w = radius * Math.sqrt(u)
t = 2 * Math::PI * v
x = (w * Math.cos(t)) / Math.cos(lat)
y = w * Math.s... | module RandomLocation
extend self
METERS_IN_DEGREE = 111_300
def near_by(lat, lng, r)
u = rand
v = rand
# Convert radius from meters to degrees
radius = r.to_f / METERS_IN_DEGREE
w = radius * Math.sqrt(u)
t = 2 * Math::PI * v
x = (w * Math.cos(t)) / Math.cos(lat)
y = w * Math.... |
Fix specs: clear cached connection between specs | require 'spec_helper'
describe Dynamoid::Config do
describe 'credentials' do
it 'passes credentials to a client connection', config: {
credentials: Aws::Credentials.new('your_access_key_id', 'your_secret_access_key')
} do
credentials = Dynamoid.adapter.client.config.credentials
expect(cred... | require 'spec_helper'
describe Dynamoid::Config do
describe 'credentials' do
let(:credentials_new) do
Aws::Credentials.new('your_access_key_id', 'your_secret_access_key')
end
before do
@credentials_old, Dynamoid.config.credentials = Dynamoid.config.credentials, credentials_new
Dynamoid... |
Allow all email to be silenced with STOP_ALL_EMAIL | Canary::App.controllers :page do
get :index, :map => "/#{ENV['BASE_CANARY_PATH']}/:page_name" do
@page_name = params[:page_name]
deliver(:hit_notifier, :hit_email, "#{@page_name} was Hit", ENV['EMAIL_DESTINATION'])
render 'index'
end
# get :sample, :map => '/sample/url', :provides => [:any, :js] do
... | Canary::App.controllers :page do
get :index, :map => "/#{ENV['BASE_CANARY_PATH']}/:page_name" do
@page_name = params[:page_name]
deliver(:hit_notifier, :hit_email, "#{@page_name} was Hit", ENV['EMAIL_DESTINATION']) unless ENV['STOP_ALL_EMAIL']
render 'index'
end
# get :sample, :map => '/sample/url',... |
Fix method which places colocated schools w charters in csv | 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}
end
en... | 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}
end
en... |
Add rake task to update changesets |
desc "Update Pre-changeset version objects with changeset data"
namespace :paper_trail do
task :rebuild_changesets => :environment do
[Note, Topic, Question, Answer].each do |klass|
puts "\n#{klass}: "
klass.find_each do |obj|
print "id(#{obj.id})-##{obj.versions.size}, "
obj.versions... | |
Fix broken colors on Windows | module Cucumber
class Broadcaster
def initialize(receivers = [])
@receivers = receivers
end
def register(receiver)
@receivers << receiver
end
def method_missing(method_name, *args)
@receivers.each do |receiver|
receiver.__send__(method_name, *args) if receiver.respond... | module Cucumber
class Broadcaster
def initialize(receivers = [])
@receivers = receivers
end
def register(receiver)
@receivers << receiver
end
def method_missing(method_name, *args)
@receivers.each do |receiver|
r = (receiver == STDOUT) ? Kernel: receiver # Needed to m... |
Add a Repository to Arrthorizer::Rails::ContextRole and add a .get_current() method | module Arrthorizer
module Rails
class ControllerAction
ControllerNotDefined = Class.new(Arrthorizer::ArrthorizerException)
ActionNotDefined = Class.new(Arrthorizer::ArrthorizerException)
attr_accessor :privilege
attr_reader :controller, :action
def initialize(attrs)
self.co... | module Arrthorizer
module Rails
class ControllerAction
ControllerNotDefined = Class.new(Arrthorizer::ArrthorizerException)
ActionNotDefined = Class.new(Arrthorizer::ArrthorizerException)
attr_accessor :privilege
attr_reader :controller_name, :action_name
def self.get_current(contro... |
Remove newline (demo for Moazzam) | require 'mailman'
require 'chronic'
settings_yaml = YAML.load_file("config.yml")["production"]
Mailman.config.rails_root = nil
Mailman.config.pop3 = { username: settings_yaml["gmail_email"],
password: settings_yaml["gmail_password"],
server: 'pop.gmail.com',
port: 995, # defaults to 110
ssl: true
}
Mailman.co... | require 'mailman'
require 'chronic'
settings_yaml = YAML.load_file("config.yml")["production"]
Mailman.config.rails_root = nil
Mailman.config.pop3 = { username: settings_yaml["gmail_email"],
password: settings_yaml["gmail_password"],
server: 'pop.gmail.com',
port: 995, # defaults to 110
ssl: true
}
Mailman.co... |
Add processing attribute to issues. | class AddProcessingToIssues < ActiveRecord::Migration
def self.up
add_column :issues, :processing, :boolean, :default => true
end
def self.down
remove_column :issues, :processing
end
end
| |
Use gems@shopify.com email address in gemspec | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'liquid/c/version'
Gem::Specification.new do |spec|
spec.name = "liquid-c"
spec.version = Liquid::C::VERSION
spec.authors = ["Justin Li", "Dylan Thacker-Smith"]
spec.e... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'liquid/c/version'
Gem::Specification.new do |spec|
spec.name = "liquid-c"
spec.version = Liquid::C::VERSION
spec.authors = ["Justin Li", "Dylan Thacker-Smith"]
spec.e... |
Add description to views generator | module Doorkeeper
module Generators
class ViewsGenerator < Rails::Generators::Base
source_root File.expand_path('../../../../app/views/doorkeeper', __FILE__)
def manifest
directory 'applications', 'app/views/doorkeeper/applications'
directory 'authorizations', 'app/views/doorkeeper/au... | module Doorkeeper
module Generators
class ViewsGenerator < Rails::Generators::Base
source_root File.expand_path('../../../../app/views/doorkeeper', __FILE__)
desc "Copies default Doorkeeper views to your application."
def manifest
directory 'applications', 'app/views/doorkeeper/applica... |
Allow several values as flow | module Vidibus
module Oauth2Server
class Oauth2ServerError < StandardError; end
class MissingTypeError < Oauth2ServerError; end
class UnsupportedTypeError < Oauth2ServerError; end
class MissingClientIdError < Oauth2ServerError; end
class InvalidClientIdError < Oauth2ServerError; end
class In... | module Vidibus
module Oauth2Server
class Oauth2ServerError < StandardError; end
class MissingTypeError < Oauth2ServerError; end
class UnsupportedTypeError < Oauth2ServerError; end
class MissingClientIdError < Oauth2ServerError; end
class InvalidClientIdError < Oauth2ServerError; end
class In... |
Add indexes to the StudyXmlRecords table | class CreateIndices < ActiveRecord::Migration
def change
add_index :studies, :nct_id
add_index :reported_events, :nct_id
add_index :reported_events, :event_type
add_index :reported_events, :subjects_affected
add_index :facilities, :nct_id
add_index :outcomes, :nct_id
add_index :outcome_m... | class CreateIndices < ActiveRecord::Migration
def change
add_index :studies, :nct_id
add_index :reported_events, :nct_id
add_index :reported_events, :event_type
add_index :reported_events, :subjects_affected
add_index :facilities, :nct_id
add_index :outcomes, :nct_id
add_index :outcome_m... |
Fix `url` stanza comment for Live Interior 3D Pro. | cask 'live-interior-3d-pro' do
version :latest
sha256 :no_check
url 'https://s3.amazonaws.com/belightsoft/LiveInterior3DPro.dmg'
name 'Live Interior 3D Pro'
homepage 'https://www.belightsoft.com/products/liveinterior/proversion.php'
license :commercial
app 'Live Interior 3D Pro.app'
end
| cask 'live-interior-3d-pro' do
version :latest
sha256 :no_check
# amazonaws.com/belightsoft was verified as official when first introduced to the cask
url 'https://s3.amazonaws.com/belightsoft/LiveInterior3DPro.dmg'
name 'Live Interior 3D Pro'
homepage 'https://www.belightsoft.com/products/liveinterior/pro... |
Use Pixiv.client instead of Pixiv.new | def init
id = ENV['PIXIV_ID'] or warn 'PIXIV_ID is not set'
password = ENV['PIXIV_PASSWORD'] or warn 'PIXIV_PASSWORD is not set'
abort unless id && password
proxy =
begin
if ENV['HTTP_PROXY']
host, port = ENV['HTTP_PROXY'].split(/:/)
[host, (port || 80).to_i]
else
nil
... | def init
id = ENV['PIXIV_ID'] or warn 'PIXIV_ID is not set'
password = ENV['PIXIV_PASSWORD'] or warn 'PIXIV_PASSWORD is not set'
abort unless id && password
proxy =
begin
if ENV['HTTP_PROXY']
host, port = ENV['HTTP_PROXY'].split(/:/)
[host, (port || 80).to_i]
else
nil
... |
Allow refinerycms-core version from >= 3.0.0 to < 4.0 | # Encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = %q{refinerycms-acts-as-indexed}
s.version = %q{2.0.1}
s.description = %q{An extension to handle the integration of Refinery CMS and ActsAsIndexed}
s.summary = %q{Refinery C... | # Encoding: UTF-8
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = %q{refinerycms-acts-as-indexed}
s.version = %q{2.0.1}
s.description = %q{An extension to handle the integration of Refinery CMS and ActsAsIndexed}
s.summary = %q{Refinery C... |
Add tests for the SessionsController | require 'rails_helper'
describe SessionsController do
it { is_expected.to be_kind_of Devise::SessionsController }
end
| require 'rails_helper'
describe SessionsController do
before { @request.env["devise.mapping"] = Devise.mappings[:user] }
it { is_expected.to be_kind_of Devise::SessionsController }
describe 'POST #create' do
describe 'after sign in' do
let(:user) { create :user }
describe 'when there is no sto... |
Update TortoiseHg to version 3.7.2 | cask 'tortoisehg' do
version '3.2.4'
sha256 'c529539e20f4ff2f6d181a5c7f64ad5dcd9346605011ab4c3725c7cedf6b5a8c'
url "https://bitbucket.org/tortoisehg/files/downloads/TortoiseHg-#{version}-mac-x64.zip"
name 'TortoiseHg'
homepage 'http://tortoisehg.bitbucket.org/'
license :gpl
app 'TortoiseHg.app'
end
| cask 'tortoisehg' do
version '3.7.2'
sha256 'e429dadbc8d2f0c784795ce9f8df88cdd0d66b26a139b4283f5b4524aa926108'
url "https://bitbucket.org/tortoisehg/files/downloads/TortoiseHg-#{version}-mac-x64.dmg"
name 'TortoiseHg'
homepage 'http://tortoisehg.bitbucket.org/'
license :gpl
app 'TortoiseHg.app'
end
|
Make sure we're using a safe version of httparty. | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'imaginary/version'
Gem::Specification.new do |gem|
gem.name = "imaginary"
gem.version = Imaginary::VERSION
gem.authors = ["Hendrik Mans"]
gem.email ... | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'imaginary/version'
Gem::Specification.new do |gem|
gem.name = "imaginary"
gem.version = Imaginary::VERSION
gem.authors = ["Hendrik Mans"]
gem.email ... |
Make loading of indexes.rb dependent on its existance | # encoding: UTF-8
module Spontaneous
class Facet
def initialize(root)
@root = root
paths.add :lib, ["lib", "**/*.rb"]
paths.add :schema, ["schema", "**/*.rb"]
paths.add :templates, "templates"
paths.add :config, "config"
paths.add :tasks, ["lib/tasks", "**/*.rake"]
paths... | # encoding: UTF-8
module Spontaneous
class Facet
def initialize(root)
@root = root
paths.add :lib, ["lib", "**/*.rb"]
paths.add :schema, ["schema", "**/*.rb"]
paths.add :templates, "templates"
paths.add :config, "config"
paths.add :tasks, ["lib/tasks", "**/*.rake"]
paths... |
Stop packaging test files with the gem | # -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
Gem::Specification.new do |s|
s.name = 'riddle'
s.version = '2.1.0'
s.platform = Gem::Platform::RUBY
s.authors = ['Pat Allan']
s.email = ['pat@freelancing-gods.com']
s.homepage = 'http://pat.github.io/riddle/'... | # -*- encoding: utf-8 -*-
$:.push File.expand_path('../lib', __FILE__)
Gem::Specification.new do |s|
s.name = 'riddle'
s.version = '2.1.0'
s.platform = Gem::Platform::RUBY
s.authors = ['Pat Allan']
s.email = ['pat@freelancing-gods.com']
s.homepage = 'http://pat.github.io/riddle/'... |
Fix bug (use DIFFICULTY as Array) | class Scoreset < Sequel::Model
many_to_one :player
one_to_many :score
def Scoreset.new_scores(player, song, registered_at)
scoreset = Scoreset.new(
player: player,
registered_at: registered_at)
scoreset.save
song.each do |s|
song_name = s[:name].gsub(/''/, '"').strip
music = ... | class Scoreset < Sequel::Model
many_to_one :player
one_to_many :score
def Scoreset.new_scores(player, song, registered_at)
scoreset = Scoreset.new(
player: player,
registered_at: registered_at)
scoreset.save
song.each do |s|
song_name = s[:name].gsub(/''/, '"').strip
music = ... |
Add script for updating user origin | #!/usr/bin/env ruby
require 'json'
def usage
<<~USAGE
Usage: #{$0} user-guid desired-origin
e.g. #{$0} 00000000-0000-0000-0000-000000000000 google
This script requires:
- uaac to be installed
- a valid uaac token
- the uaac target is set up correctly
Set the UAA target with uaac target... | |
Test with not-null constraint and index | ActiveRecord::Schema.define(:version => 1) do
create_table "articles", :force => true do |t|
t.column "headline", "string"
t.column "section", "string"
t.column "slug", "string"
t.column "type", "string"
end
create_table "people", :force => true do |t|
t.column "name", "string"
t.colum... | ActiveRecord::Schema.define(:version => 1) do
create_table "articles", :force => true do |t|
t.column "headline", "string", null: false
t.column "section", "string"
t.column "slug", "string", null: false
t.column "type", "string"
t.index ["slug"], name: "index_articles_on_slug", unique: true
end... |
Upgrade radiant player to v1.2.1 | class RadiantPlayer < Cask
url 'https://github.com/kbhomes/google-music-mac/releases/download/v1.2.0/Radiant.Player.zip'
homepage 'http://kbhomes.github.io/google-music-mac/'
version '1.2.0'
sha256 '7a9a0d7b1a17cee599012f216cc285bcabe6a1005ddb87d531e7a44875a67131'
link 'Radiant Player.app'
end
| class RadiantPlayer < Cask
url 'https://github.com/kbhomes/google-music-mac/releases/download/v1.2.1/Radiant.Player.zip'
homepage 'http://kbhomes.github.io/google-music-mac/'
version '1.2.1'
sha256 'dc1ed98170e05c430779f527191717cb412e74f398324878286df4a2bbad79d4'
link 'Radiant Player.app'
end
|
Add basic browser test for Get Help request and ticket system | # frozen_string_literal: true
require 'rails_helper'
describe 'ticket system', type: :feature, js: true do
let(:course) { create(:course) }
let(:admin) { create(:admin, email: 'spec@wikiedu.org') }
before do
login_as admin
stub_token_request
create(:courses_user, course: course, user: admin,
... | |
Add header tests to check for min/max (or lack of max) client version | # -*- coding: utf-8 -*-
#
# Author:: Douglas Triggs (<doug@getchef.com>)
# Copyright:: Copyright (c) 2014 Chef, Inc.
describe "Headers" do
let (:request_url) { api_url("users") }
let (:requestor) { platform.admin_user }
context "Request Headers" do
# Right, now, we're just checking header versions, this ca... | |
Set metdata_expire to 1 second so yum updates quickly | include_recipe 'java'
yum_repository "datastax" do
description "DataStax Repo for Apache Cassandra"
url "http://rpm.datastax.com/community"
gpgcheck false
sslverify false
action :create
end
package 'dsc20-2.0.12-1'
package 'cassandra20-2.0.12-1'
include_recipe 'midokura::zookeeper'
include_recipe 'midokura... | include_recipe 'java'
yum_repository "datastax" do
description "DataStax Repo for Apache Cassandra"
url "http://rpm.datastax.com/community"
gpgcheck false
metadata_expire "1"
sslverify false
action :create
end
package 'dsc20-2.0.12-1'
package 'cassandra20-2.0.12-1'
include_recipe 'midokura::zookeeper'
in... |
Fix pessimistic dependency on Compass | require './lib/quantity-queries'
Gem::Specification.new do |s|
# Release Specific Information
s.version = QuantityQueries::VERSION
s.date = QuantityQueries::DATE
# Gem Details
s.name = "quantity-queries"
s.rubyforge_project = "quantity-queries"
s.description = %q{Simple item quantity queries mixins for ... | require './lib/quantity-queries'
Gem::Specification.new do |s|
# Release Specific Information
s.version = QuantityQueries::VERSION
s.date = QuantityQueries::DATE
# Gem Details
s.name = "quantity-queries"
s.rubyforge_project = "quantity-queries"
s.description = %q{Simple item quantity queries mixins for ... |
Add gem homepage to gemspec | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'feed_duck/version'
Gem::Specification.new do |spec|
spec.name = "feed_duck"
spec.version = FeedDuck::VERSION
spec.authors = ["André Bernardes"]
spec.email = [... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'feed_duck/version'
Gem::Specification.new do |spec|
spec.name = "feed_duck"
spec.version = FeedDuck::VERSION
spec.authors = ["André Bernardes"]
spec.email = [... |
Make sign in sessions last (way, way) longer | class TwitchController < ApplicationController
def out
redirect_to "https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=#{client_id}&redirect_uri=#{redirect_uri}&scope=user_read"
end
def in
post = { client_id: client_id,
client_secret: client_secret,
... | class TwitchController < ApplicationController
def out
redirect_to "https://api.twitch.tv/kraken/oauth2/authorize?response_type=code&client_id=#{client_id}&redirect_uri=#{redirect_uri}&scope=user_read"
end
def in
post = { client_id: client_id,
client_secret: client_secret,
... |
Package version is increased from 0.3.0.0 to 0.3.0.1 | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'event_store-messaging'
s.summary = 'Messaging primitives for EventStore using the EventStore Client HTTP library'
s.version = '0.3.0.0'
s.authors = ['']
s.require_paths = ['lib']
s.files = Dir.glob('{lib}/**/*')
s.platform = Gem::Platform::... | # -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = 'event_store-messaging'
s.summary = 'Messaging primitives for EventStore using the EventStore Client HTTP library'
s.version = '0.3.0.1'
s.authors = ['']
s.require_paths = ['lib']
s.files = Dir.glob('{lib}/**/*')
s.platform = Gem::Platform::... |
Update podspec file to version 0.2 | Pod::Spec.new do |s|
s.name = 'SPDebugMenu'
s.version = '0.1'
s.license = 'MIT'
s.summary = 'Make your own debug menu with fully customizable actions.'
s.homepage = 'https://github.com/sergiou87/SPDebugMenu.git'
s.author = { "Sergio Padrino" => "sergio.padrino@gmail.com" }
s.source = { :git => ... | Pod::Spec.new do |s|
s.name = 'SPDebugMenu'
s.version = '0.2'
s.license = 'MIT'
s.summary = 'Make your own debug menu with fully customizable actions.'
s.homepage = 'https://github.com/sergiou87/SPDebugMenu.git'
s.author = { "Sergio Padrino" => "sergio.padrino@gmail.com" }
s.source = { :git => ... |
Add ShellSvnBridge for platforms where the svn bindings are not easily installable. | require "open3"
require "nokogiri"
module CukeQ
class Scm
class ShellSvnBridge
def initialize(url, working_copy)
@url = url
@working_copy = working_copy
end
def update
ensure_working_copy
Dir.chdir(@working_copy) { execute "svn update --non-inter... | |
Fix SDVersion import for Travis. | Pod::Spec.new do |s|
s.name = "IRLSize"
s.version = "0.5.0"
s.summary = "A library for determining the actual physical size of pixels on an iOS device."
s.description = <<-DESC
IRLSize is used to determine the physical size of the iOS
... | Pod::Spec.new do |s|
s.name = "IRLSize"
s.version = "0.5.0"
s.summary = "A library for determining the actual physical size of pixels on an iOS device."
s.description = <<-DESC
IRLSize is used to determine the physical size of the iOS
... |
Apply patch 21285 from Morus Walter which adds RelaxNG support. | require "xml"
require 'test/unit'
class TestRelaxNG < Test::Unit::TestCase
def setup
xp = XML::Parser.new
@doc = XML::Document.file(File.join(File.dirname(__FILE__), 'model/shiporder.xml'))
end
def teardown
@doc = nil
end
def relaxng
document = XML::Document.file(File.join(File.dirname(... | |
Add method to render handshake response | module WebSocket
class ServerHandshake < Http::Response
def initialize(status = nil, version = "1.1", headers = {}, body = nil, &body_proc)
@status, @version, @body, @body_proc = status, version, body, body_proc
@headers = headers
end
end
end | module WebSocket
class ServerHandshake < Http::Response
def initialize(status = 101, version = "1.1", headers = {}, body = nil, &body_proc)
@status, @version, @body, @body_proc = status, version, body, body_proc
@headers = headers
end
def render(out)
response_header = "#{@version} #{@s... |
Fix quotes so publishing script works | Pod::Spec.new do |s|
s.name = 'TrailsKit'
s.version = '0.3.0'
s.summary = 'Tools for representing and displaying geographical data for parks and trails.'
s.homepage = 'https://github.com/mmertsock/TrailsKit'
s.author = 'mmertsock'
s.requires_arc = true
s.ios.deployment_target = '7.0'
s.source_file... | Pod::Spec.new do |s|
s.name = "TrailsKit"
s.version = "0.3.0"
s.summary = "Tools for representing and displaying geographical data for parks and trails."
s.homepage = "https://github.com/mmertsock/TrailsKit"
s.author = "mmertsock"
s.requires_arc = true
s.ios.deployment_target = "7.0"
s.source_file... |
Add an example useage of the eventual api | $:.push File.expand_path('../../lib', __FILE__)
require 'zulip'
### Sends a private message to a new thread is posted to a specified stream
class ZulipEcho
client = Zulip::Client.new do |config|
config.bot_email_address = "bot@example.com"
config.bot_api_key = "apikey"
end
client.stream_messages do |me... | |
Fix for default item model | class PlaylistItem < ActiveRecord::Base
acts_as_category :scope => :playlist, :hidden => :active
acts_as_authorization_object
belongs_to :resource_item, :polymorphic => true
ITEM_TYPES = [["Basic URL", "ItemDefault"],["Youtube Video", "ItemYoutube"],["Image", "ItemImage"],["Text File", "ItemText"]]
end
| class PlaylistItem < ActiveRecord::Base
include AuthUtilities
acts_as_category :scope => :playlist, :hidden => :active
acts_as_authorization_object
belongs_to :resource_item, :polymorphic => true
ITEM_TYPES = [["Basic URL", "ItemDefault"],["Youtube Video", "ItemYoutube"],["Image", "ItemImage"],["Text Fil... |
Add rake task for mass publishing | namespace :publishing_api do
desc "Publish all Policies to the Publishing API"
task publish_policies: :environment do
PolicyArea.all.map(&:save)
Programme.all.map(&:save)
end
end
| |
Fix warnings with recent thor versions | require "rails/generators"
require "rails/generators/rails/controller/controller_generator"
require "rails/generators/rails/scaffold_controller/scaffold_controller_generator"
module Rails
module Generators
class ControllerGenerator
hook_for :decorator, default: true do |generator|
invoke generator,... | require "rails/generators"
require "rails/generators/rails/controller/controller_generator"
require "rails/generators/rails/scaffold_controller/scaffold_controller_generator"
module Rails
module Generators
class ControllerGenerator
hook_for :decorator, type: :boolean, default: true do |generator|
i... |
Add suffix to average age | SCHEDULER.every '1h', :first_at => Time.now do
send_event('members', { current: CommercialDashboard.members })
send_event('age', { current: CommercialDashboard.age })
send_event('old-opportunities', { current: CommercialDashboard.old_opportunities })
end | #!/bin/env ruby
# encoding: utf-8
SCHEDULER.every '1h', :first_at => Time.now do
send_event('members', { current: CommercialDashboard.members })
send_event('age', { current: CommercialDashboard.age, suffix: " days" })
send_event('old-opportunities', { current: CommercialDashboard.old_opportunities })
send_even... |
Add read preference getter rdoc | require "moped/read_preference/nearest"
require "moped/read_preference/primary"
require "moped/read_preference/primary_preferred"
require "moped/read_preference/secondary"
require "moped/read_preference/secondary_preferred"
module Moped
module ReadPreference
extend self
PREFERENCES = {
nearest: Neares... | require "moped/read_preference/nearest"
require "moped/read_preference/primary"
require "moped/read_preference/primary_preferred"
require "moped/read_preference/secondary"
require "moped/read_preference/secondary_preferred"
module Moped
# Provides behaviour around getting various read preference implementations.
... |
Compress the template when we attempt to validate it | module StackMaster
class Validator
def self.valid?(stack_definition, config)
new(stack_definition, config).perform
end
def initialize(stack_definition, config)
@stack_definition = stack_definition
@config = config
end
def perform
StackMaster.stdout.print "#{@stack_definit... | module StackMaster
class Validator
def self.valid?(stack_definition, config)
new(stack_definition, config).perform
end
def initialize(stack_definition, config)
@stack_definition = stack_definition
@config = config
end
def perform
StackMaster.stdout.print "#{@stack_definit... |
Add specs for user observer | require 'spec_helper'
describe UserObserver do
end
| require 'spec_helper'
describe UserObserver do
describe '#before_validation' do
let(:user) { build(:user, password: nil) }
before { user.valid? }
it { expect(user.password).to_not be_empty }
end
describe '#after_create' do
before { UserObserver.any_instance.unstub(:after_create) }
context '... |
Make support app hack slightly less fragile | class RootController < ApplicationController
include UserPermissionsControllerMethods
before_filter :authenticate_user!
def index
@applications_and_permissions = applications_and_permissions(current_user)
.sort_by { |application, permission| application.name }
.select { |application, permi... | class RootController < ApplicationController
include UserPermissionsControllerMethods
before_filter :authenticate_user!
def index
@applications_and_permissions = applications_and_permissions(current_user)
.sort_by { |application, permission| application.name }
.select { |application, permi... |
Replace deprecated Devise sign_in bypass option in tests | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Extension: Devise: sign_in with resource', type: :controller do
class self::TestUser < User
before_sign_in :before_callback
after_sign_in :after_callback
def before_callback
end
def after_callback
end
end
controller d... | # frozen_string_literal: true
require 'rails_helper'
RSpec.describe 'Extension: Devise: sign_in with resource', type: :controller do
class self::TestUser < User
before_sign_in :before_callback
after_sign_in :after_callback
def before_callback
end
def after_callback
end
end
controller d... |
Change http refernce to jquery at google to https |
require 'asciidoctor'
require 'asciidoctor/extensions'
require 'asciidoctor/latex/core_ext/colored_string'
#
module Asciidoctor::LaTeX
class InjectHTML < Asciidoctor::Extensions::Postprocessor
def process document, output
output.gsub('</head>', $click_insertion)
end
end
$click_insertion = <<E... |
require 'asciidoctor'
require 'asciidoctor/extensions'
require 'asciidoctor/latex/core_ext/colored_string'
#
module Asciidoctor::LaTeX
class InjectHTML < Asciidoctor::Extensions::Postprocessor
def process document, output
output.gsub('</head>', $click_insertion)
end
end
$click_insertion = <<E... |
Add validations to the singleton guard & the mock synchronization token. Refs 16. | require 'duckrails/synchronizer'
module Duckrails
# The application state
class ApplicationState < ActiveRecord::Base
self.table_name = 'application_state'
default_scope { order(id: :desc) }
validates_inclusion_of :singleton_guard, in: [0]
class << self
# @return [ApplicationState] the one... | require 'duckrails/synchronizer'
module Duckrails
# The application state
class ApplicationState < ActiveRecord::Base
self.table_name = 'application_state'
default_scope { order(id: :desc) }
validates :singleton_guard, inclusion: { in: [0] }
validates :mock_synchronization_token, presence: true
... |
Update djay Pro to 1.2-201508141249 | cask :v1 => 'djay-pro' do
version '1.1.3-201506261526'
sha256 '47bb67196483e684ce3009088886e915fb9e83049fc263d3cc96d38755f5185c'
url "http://download.algoriddim.com/djay/#{version.sub(%r{.*?-},'')}/djay_Pro_#{version.sub(%r{-\d+$},'')}.zip"
name 'djay Pro'
appcast 'https://www.algoriddim.com/djay-mac/release... | cask :v1 => 'djay-pro' do
version '1.2-201508141249'
sha256 '1abf8861828d6233cf0254b0fe8621f2fb8ce1780201b2d1af1cdb1c3c8463af'
url "http://download.algoriddim.com/djay/#{version.sub(%r{.*?-},'')}/djay_Pro_#{version.sub(%r{-\d+$},'')}.zip"
name 'djay Pro'
appcast 'https://www.algoriddim.com/djay-mac/releaseno... |
Add global_registry as a dependency | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cru_lib/version'
Gem::Specification.new do |spec|
spec.name = "cru_lib"
spec.version = CruLib::VERSION
spec.authors = ["Josh Starcher"]
spec.email = ["josh.st... | # coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'cru_lib/version'
Gem::Specification.new do |spec|
spec.name = "cru_lib"
spec.version = CruLib::VERSION
spec.authors = ["Josh Starcher"]
spec.email = ["josh.st... |
Update Gem number to 0.2.9 | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |s|
s.name = "fluent-plugin-juniper-telemetry"
s.version = '0.2.8'
s.authors = ["Damien Garros"]
s.email = ["dgarros@gmail.com"]
... | # -*- encoding: utf-8 -*-
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Gem::Specification.new do |s|
s.name = "fluent-plugin-juniper-telemetry"
s.version = '0.2.9'
s.authors = ["Damien Garros"]
s.email = ["dgarros@gmail.com"]
... |
Fix case when field is not in hstore/jsonb | require "carrierwave/orm/activerecord"
module CarrierWave
module ActiveRecord
module Accessable
##
# See +CarrierWave::Mount#mount_uploader+ for documentation
#
def mount_uploader(column, uploader=nil, options={}, &block)
super
ar_store = self.stored_attributes.find{|stor... | require "carrierwave/orm/activerecord"
module CarrierWave
module ActiveRecord
module Accessable
##
# See +CarrierWave::Mount#mount_uploader+ for documentation
#
def mount_uploader(column, uploader=nil, options={}, &block)
super
ar_store = self.stored_attributes.find{|stor... |
Extend timeouts on cube upload | require 'fog/octocloud/requests/compute/convert_cube'
module Fog
module Compute
class Octocloud
class Real
def remote_upload_cube(id, file)
# Get some VMDK action.
upload = Pathname.new(file)
dir = nil
if upload.extname != '.vmdk'
dir = Dir.mktmp... | require 'fog/octocloud/requests/compute/convert_cube'
module Fog
module Compute
class Octocloud
class Real
def remote_upload_cube(id, file)
# Get some VMDK action.
upload = Pathname.new(file)
dir = nil
if upload.extname != '.vmdk'
dir = Dir.mktmp... |
Add ruby implementation as "check" |
def pixels_for_count(count)
# count > 4 ? '#' : '.'
[' ','.','-','/','|','<','{','%','&','@','#'][count % 10]
end
acorn = -2.4
bcorn = -1.2
size = 3.1
pixels = []
(1..150).each do |j|
pixels[j-1] = []
(1..150).each do |k|
ca = acorn + ((j * size) / 150.0)
cb = bcorn + ((k * size) / 150.0)
count = ... | |
Add blank Taxation and TaxRule classes | module Chargify
class Transaction < Base
def full_refund(attrs = {})
return false if self.transaction_type != 'payment'
attrs.merge!(:amount_in_cents => self.amount_in_cents)
self.refund(attrs)
end
def refund(attrs = {})
return false if self.transaction_type != 'payment'
a... | module Chargify
class Transaction < Base
def full_refund(attrs = {})
return false if self.transaction_type != 'payment'
attrs.merge!(:amount_in_cents => self.amount_in_cents)
self.refund(attrs)
end
def refund(attrs = {})
return false if self.transaction_type != 'payment'
a... |
Check if User is defined on ResizeApiKeyField Migration (like others) | class ResizeApiKeyField < ActiveRecord::Migration
def change
change_column :spree_users, :api_key, :string, :limit => 48
end
end
| class ResizeApiKeyField < ActiveRecord::Migration
def change
unless defined?(User)
change_column :spree_users, :api_key, :string, :limit => 48
end
end
end
|
Use RUBY_VERSION instead of VERSION | require 'filelock/version'
require 'timeout'
if VERSION <= "1.8.7"
require 'tempfile'
def Filelock(lockname, options = {}, &block)
lockname = lockname.path if lockname.is_a?(Tempfile)
File.open(lockname, File::RDWR|File::CREAT, 0644) do |file|
file.flock(File::LOCK_EX)
Timeout::timeout(options... | require 'filelock/version'
require 'timeout'
if RUBY_VERSION <= "1.8.7"
require 'tempfile'
def Filelock(lockname, options = {}, &block)
lockname = lockname.path if lockname.is_a?(Tempfile)
File.open(lockname, File::RDWR|File::CREAT, 0644) do |file|
file.flock(File::LOCK_EX)
Timeout::timeout(op... |
Define a generic Response record which checks the trailing success code | module YubiOATH
CLA = 0x00
AID = [0xA0, 0x00, 0x00, 0x05, 0x27, 0x21, 0x01, 0x01]
end
| require 'bindata'
module YubiOATH
CLA = 0x00
AID = [0xA0, 0x00, 0x00, 0x05, 0x27, 0x21, 0x01, 0x01]
class Response < BinData::Record
count_bytes_remaining :data_length
string :data, read_length: -> { data_length - 2 }
array :success, type: :uint8, initial_length: 2
def success?
success ==... |
Fix style violations in robot-name | require 'minitest/autorun'
require_relative 'robot_name'
class RobotTest < Minitest::Test
def test_has_name
# rubocop:disable Lint/AmbiguousRegexpLiteral
assert_match /^[A-Z]{2}\d{3}$/, Robot.new.name
# rubocop:enable Lint/AmbiguousRegexpLiteral
end
def test_name_sticks
skip
robot = Robot.ne... | require 'minitest/autorun'
require_relative 'robot_name'
class RobotTest < Minitest::Test
COMMAND_QUERY = <<-MSG
Command/Query Separation:
Query methods should generally not change object state.
MSG
def test_has_name
# rubocop:disable Lint/AmbiguousRegexpLiteral
assert_match /^[A-Z]{2}\d{3}$/, R... |
Add initial Rack request/response handling classes. | require "savannah/version"
require 'rack'
module Savannah
class Main
def call(env)
[200, {}, ["Hello", "Whatever"]]
end
end
end
| require "savannah/version"
require 'rack'
module Savannah
class Main
attr_accessor :router
def initialize(env={})
@router = Router.new
end
def call(env)
route = @router.route_for(env)
if route
response = route.execute(env)
response.rack_response
else
... |
Add http auth state tests. | # encoding: UTF-8
require 'vines'
require 'minitest/autorun'
class HttpAuthTest < MiniTest::Unit::TestCase
def setup
@stream = MiniTest::Mock.new
@state = Vines::Stream::Http::Auth.new(@stream, nil)
end
def test_missing_body_raises_error
node = node('<presence type="unavailable"/>')
assert_rais... | |
Update Sprinkle example to really be an example of the smallest Sprinkle script possible for deploying a single gem to a remote host, also demonstrates and example of using package recommendations to optionally rely on rubygems | #!/usr/bin/env sprinkle -s
# Example of a simple Sprinkle script to install a single gem on a remote host.
# Packages, sprinkle and its dependencies including rubygems and ruby, delivery mechanism
# uses Vlad
package :build_essential do
description 'Build tools'
apt 'build-essential'
end
package :ruby do
desc... | #!/usr/bin/env sprinkle -c -s
# Example of the simplest Sprinkle script to install a single gem on a remote host. This
# particular script assumes that rubygems (and ruby, etc) are already installed on the remote
# host. To see a larger example of installing an entire ruby, rubygems, gem stack from source,
# please se... |
Migrate spec from should to expect | # encoding: utf-8
require 'spec_helper'
module Rubocop
module Cop
describe Cop do
let (:cop) { Cop.new }
it 'initially has 0 offences' do
cop.offences.size.should == 0
end
it 'initially has nothing to report' do
cop.has_report?.should be_false
end
it 'keeps... | # encoding: utf-8
require 'spec_helper'
module Rubocop
module Cop
describe Cop do
let (:cop) { Cop.new }
it 'initially has 0 offences' do
expect(cop.offences).to be_empty
end
it 'initially has nothing to report' do
expect(cop.has_report?).to be_false
end
it... |
Add Local Transaction integration test. | require 'integration_test_helper'
class LocalTransactionApiTest < ActionDispatch::IntegrationTest
setup do
authority = FactoryGirl.create(:local_authority_with_contact,
snac: "AA00",
contact_address: ["Line 1", "line 2"],
contact_url: "http://some.council.gov.uk/contact",
contact_phone: "... | |
Fix commit issue for run process | module Spree
class ProductExport < ActiveRecord::Base
has_attached_file :attachment
validates_attachment :attachment, content_type: { content_type: "text/csv" }
after_commit :run_export
def finished?
total_rows == processed_rows
end
def finish_percent
if total_rows > 0
pr... | module Spree
class ProductExport < ActiveRecord::Base
has_attached_file :attachment
validates_attachment :attachment, content_type: { content_type: "text/csv" }
after_commit :run_export, on: :create
def finished?
total_rows == processed_rows
end
def finish_percent
if total_rows >... |
Fix for the case Rails.application.assets is nil | module Haml
module Filters
# This is an extension of Sass::Rails's SassTemplate class that allows
# Rails's asset helpers to be used inside Haml Sass filter.
class SassRailsTemplate < ::Sass::Rails::SassTemplate
if Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new('3.0.0')
def render(... | module Haml
module Filters
# This is an extension of Sass::Rails's SassTemplate class that allows
# Rails's asset helpers to be used inside Haml Sass filter.
class SassRailsTemplate < ::Sass::Rails::SassTemplate
if Gem::Version.new(Sprockets::VERSION) >= Gem::Version.new('3.0.0')
def render(... |
Remove some extra new lines. | class RecordingParent < BasicObject
class << self
def method_missing(m, *args, &block)
__missing_class_macros__.push({ m => [args, block].compact })
end
def __missing_class_macros__
@__missing_class_macros__ ||= []
end
module ConstMissing
def const_missing(const_sym)
... | class RecordingParent < BasicObject
class << self
def method_missing(m, *args, &block)
__missing_class_macros__.push({ m => [args, block].compact })
end
def __missing_class_macros__
@__missing_class_macros__ ||= []
end
module ConstMissing
def const_missing(const_sym)
if... |
Correct iso code for pound | namespace :spree_multicurrency do
desc "Refresh currency rate"
task :refresh_currency_rate => :environment do
resp = Net::HTTP.get_response(URI.parse('http://openexchangerates.org/latest.json'))
hash = JSON.parse(resp.body)
if hash.has_key? 'Error'
raise "web service error"
end
hash['... | namespace :spree_multicurrency do
desc "Refresh currency rate"
task :refresh_currency_rate => :environment do
resp = Net::HTTP.get_response(URI.parse('http://openexchangerates.org/latest.json'))
hash = JSON.parse(resp.body)
if hash.has_key? 'Error'
raise "web service error"
end
hash['... |
Add a complete test for the BatchResult class. | require 'test_helper'
class TestBatchResult < Test::Unit::TestCase
def setup
@result_created = SalesforceBulk::BatchResult.new('123', true, true, '')
@result_updated = SalesforceBulk::BatchResult.new('123', true, false, '')
@result_failed = SalesforceBulk::BatchResult.new('123', false, false, 'Some Er... | |
Add missing dependency for Beaker tests | require 'beaker-rspec/helpers/serverspec'
require 'beaker-rspec/spec_helper'
require 'beaker/puppet_install_helper'
run_puppet_install_helper
SUPPORTED_PLATFORMS = ['Debian'].freeze
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
# Readable test desc... | require 'beaker-rspec/helpers/serverspec'
require 'beaker-rspec/spec_helper'
require 'beaker/puppet_install_helper'
run_puppet_install_helper
SUPPORTED_PLATFORMS = ['Debian'].freeze
RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
# Readable test desc... |
Add errors on :password when digest is missing | require "sequel_secure_password/version"
require "bcrypt"
module Sequel
module Plugins
module SecurePassword
# Configure the plugin by setting the available options. Options:
# * :cost - the cost factor when creating password hash. Default:
# BCrypt::Engine::DEFAULT_COST(10)
def self.con... | require "sequel_secure_password/version"
require "bcrypt"
module Sequel
module Plugins
module SecurePassword
# Configure the plugin by setting the available options. Options:
# * :cost - the cost factor when creating password hash. Default:
# BCrypt::Engine::DEFAULT_COST(10)
def self.con... |
Revert "(maint) make install_puppetdb and install_puppetdb_terminus versions nil" | # We skip this step entirely unless we are running in :upgrade mode.
if (test_config[:install_mode] == :upgrade)
step "Install most recent released PuppetDB on the PuppetDB server for upgrade test" do
install_puppetdb(database, test_config[:database])
start_puppetdb(database)
install_puppetdb_termini(mast... | # We skip this step entirely unless we are running in :upgrade mode.
if (test_config[:install_mode] == :upgrade)
step "Install most recent released PuppetDB on the PuppetDB server for upgrade test" do
install_puppetdb(database, test_config[:database], 'latest')
start_puppetdb(database)
install_puppetdb_te... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.