Skip to content

Instantly share code, notes, and snippets.

@jilucev
jilucev / gist:9381660
Last active August 29, 2015 13:57
Here is a less messed up code w1d3
states = {
OR: 'Oregon',
FL: 'Florida',
CA: 'California',
NY: 'New York',
MI: 'Michigan'
}
states[:AR] = "Arkansas"
states[:HA] = "Hawaii"
@jilucev
jilucev / gist:9382912
Created March 6, 2014 04:57
Cool beans!
states = {
OR: 'Oregon',
FL: 'Florida',
CA: 'California',
NY: 'New York',
MI: 'Michigan'
}
states[:AR] = "Arkansas"
states[:HA] = "Hawaii"
# In this file we define the methods to help filter out candidates
# This way, we keep these methods separated from other potential parts of the program
def experienced?(candidate)
amount_of_experience = candidate[:years_of_experience]
if amount_of_experience > 2
return true
else
return false
module Foo
class Bar
attr_accessor :qux_service,
:param1,
:param2
#initialize the class and dependencies
def initialize(foo_klass = Foo)
@foo_klass = foo_klass
@jilucev
jilucev / bad_state.rb
Created August 24, 2018 21:35
Enema of the state
# frozen_string_literal: true
module Hodor
class MainService
attr_accessor :foo_klass,
:foo,
:foo_id
:foo_status,
:bar_service,
:baz_service,
@jilucev
jilucev / rake_task.rb
Created August 24, 2018 22:18
A rake task
namespace :foo do
desc "Removes all bars for a given foo"\
" Example: bundle exec rake foo:remove_bars[2]"
task :remove_bars, [:foo_id] => [:environment] do |t, args|
foo_id = args[:foo_id].to_i
Bar.where(foo_id: foo_id).delete_all
end
# frozen_string_literal: true
require 'rails_helper'
require 'app/services/doc_gen/application_merge_tag_recipe'
describe DocGen::ApplicationMergeTagRecipe do
describe '#call' do
let(:account) { Fabricate.create(:account) }
let(:loan) { FactoryBot.create(:loan, account: account, team: account.team, liability: liability) }