This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe "copying" do | |
| context "within a cabinet_template" do | |
| let (:cabinet_template) { FactoryGirl.create :cabinet_template } | |
| let!(:ports) do | |
| FactoryGirl.create_list(:component, | |
| :with_ports, | |
| :number_of_ports => 1, | |
| :cabinet => cabinet_template).collect(&:ports).reduce(&:+).tap do |ports| | |
| FactoryGirl.create :cable, :connections => ports | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def add_rotator_to(hash) | |
| hash.define_singleton_method :rotator do | |
| inject({}) do |rotated, key_value| | |
| if key_value.first =~ /_rotate/ | |
| rotated.merge key_value.first[0..-8].to_sym => self[key_value.first].rotate!.first | |
| else | |
| rotated.merge key_value.first => key_value.last | |
| end | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module TouchMyScheme | |
| after_save :touch_my_scheme | |
| def touch_my_scheme | |
| scheme.touch | |
| end | |
| end | |
| include "lib/touch_my_scheme" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Load plugins (only those I whitelist) | |
| Pry.config.should_load_plugins = false | |
| Pry.plugins["doc"].activate! | |
| # Launch Pry with access to the entire Rails stack. | |
| # If you have Pry in your Gemfile, you can pass: ./script/console --irb=pry instead. | |
| # If you don't, you can load it through the lines below :) | |
| rails = File.join Dir.getwd, 'config', 'environment.rb' | |
| if File.exist?(rails) && ENV['SKIP_RAILS'].nil? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if application "Messages" is running then | |
| tell application "Messages" | |
| log in service "transue@gmail.com" | |
| set status of service "transue@gmail.com" to available | |
| set status message to "%Track - %Artist" | |
| end tell | |
| end if |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def collect_options_for_select(collection, selected=nil, &block) | |
| options_for_select collection.collect { |member| block.call member }, selected | |
| end | |
| def elevations_for_sub_component_select(sub_component) | |
| collect_options_for_select sub_component.component.send(sub_component.class.name.underscore.pluralize).find_all_by_model_id(sub_component.model_id), url_for do |sub_component| | |
| if sub_component.is_a? SubComponentTemplate | |
| [ sub_component.location, edit_admin_component_sub_component_path(sub_component.component, sub_component) ] | |
| else | |
| [ sub_component.location, edit_component_sub_component_path(sub_component.component, sub_component) ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if [ ! -z "$TMOUT" ]; then | |
| env -i bash --init-file ~/.bash_profile | |
| fi | |
| # .bash_profile | |
| export SHELL='/bin/bash' | |
| export HOME='/home/bill.transue' | |
| # git bash prompt | |
| export PS1='\u@\h:\W$(__git_ps1 " (\[\033[32m\]%s\[\033[m\])")$ ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shared_examples_for 'a contact' do |options={}| | |
| it { should be_a(Contact) } | |
| its(:first_name) { should ==(first_name) } | |
| its(:last_name) { should ==(last_name) } | |
| its(:email) { should ==(email) } | |
| unless options[:except_a_phone_number] | |
| it "should scrape the phone number" do | |
| subject.extended_contact_data_attributes[:phone_numbers].first[:value].should ==(phone_number) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Enumerable | |
| def collect_if | |
| collect { |e| yield e }.reject &:nil | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| LeadGeneration::Lead.stub(:scrape_contact_from) do |email, attributes={}| | |
| FactoryGirl.build :contact, attributes | |
| end |