Skip to content

Instantly share code, notes, and snippets.

@andreypronin
andreypronin / .hound.yml
Created October 5, 2014 13:38
Hound configuration
ruby:
enabled: true
# config_file: config/.rubocop.yml
coffee_script:
enabled: true
# config_file: config/.coffeelint.json
# java_script:
# enabled: true
@andreypronin
andreypronin / .travis.yml
Created October 5, 2014 13:36
.travis.yml for gems
language: ruby
cache: bundler
rvm:
- 2.1.2
branches:
only:
- master
@andreypronin
andreypronin / spec_helper.rb
Created October 5, 2014 13:34
Stubbing AWS in spec_helper. Will also not run tests marked with :live_avs tag.
if ENV.has_key?("STUB_AWS") ||
!ENV.has_key?("AWS_ACCESS_KEY_ID") ||
!ENV.has_key?("AWS_SECRET_ACCESS_KEY")
# Test in the environment where AWS credentials are not provided
require 'aws-sdk'
puts "Stubbing AWS (#{ENV.has_key?("STUB_AWS") ? "forced" : "no keys"})"
RSpec.configure do |c|
c.filter_run_excluding :live_aws
end
@andreypronin
andreypronin / spec_helper.rb
Created October 5, 2014 13:31
Gem spec_helper with coveralls and dotenv
require 'coveralls'
Coveralls.wear!
require 'dotenv'
Dotenv.load
require '<gem>'
@andreypronin
andreypronin / README.md
Created October 5, 2014 13:29
Gem README template

NOT FOR PUBLIC USE YET. ACTIVE INITIAL DEVELOPMENT IS IN PROGRESS.

TODO: Brief description. TODO: Describe the problem & the solution.

Build Status Coverage Status

@andreypronin
andreypronin / Rakefile
Created October 5, 2014 13:20
Rakefile with 'spec' task
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
desc "Run RSpec tests (use rake spec SPEC_OPTS='...' to pass rspec options)"
RSpec::Core::RakeTask.new(:spec)
@andreypronin
andreypronin / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@andreypronin
andreypronin / .gitignore
Last active August 29, 2015 14:06
My standard .gitignore: MacOS, TextMate, Vagrant, dotenv | figaro, rspec, Capybara, fog Gem-compatible
# Ignore application configuration
/config/application.yml
/config/fog_credentials.yml
# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal
# Ignore all logfiles and tempfiles and local system/bin files
/log
@andreypronin
andreypronin / hstore_accessor_for_model.rb
Created May 15, 2013 19:13
HStore accessor: Postgres, Rails
def hstore_get(field_name)
method(field_name).call
end
def hstore_set(field_name,value)
method("#{field_name}=").call(value)
end
def hstore_accessor(field_name,name)
define_method(name) do
hstore = hstore_get(field_name)
@andreypronin
andreypronin / custom_plan_zeus_rspec.rb
Created April 6, 2013 15:18
Custom_plan.rb and zeus.json for smooth RSpec experience with Zeus.
require 'zeus/rails'
class CustomPlan < Zeus::Rails
def spec(argv=ARGV)
# disable autorun in case the user left it in spec_helper.rb
RSpec::Core::Runner.disable_autorun!
exit RSpec::Core::Runner.run(argv)
end
end