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 Marriage do | |
| let(:traditional_marriage) { FactoryGirl.create(:couple, :hetero) } | |
| context "same-sex" do | |
| let(:same_sex_marriage) { FactoryGirl.create(:couple, :homo) } | |
| subject { same_sex_marriage } | |
| it { should equal traditional_marriage } | |
| 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 recover_dependent_associations(window, options) | |
| self.class.dependent_associations.each do |reflection| | |
| the_klass = if reflection.macro == :belongs_to && reflection.options.include?(:polymorphic) | |
| self.send("#{reflection.name}_type").constantize | |
| else | |
| reflection.klass | |
| end | |
| next unless the_klass.paranoid? |
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
| require 'benchmark' | |
| rubies = ['1.9.2-p290', '1.9.3-p0', '1.9.3-p0-patched'] | |
| n = 10 # number of times to run | |
| Benchmark.bm(7) do |x| | |
| rubies.each do |ruby| | |
| x.report("#{ruby}") { n.times{ `rvm-shell #{ruby} -c 'cd ~/code/consolo && bundle exec rails runner puts "ruby!"' &> /dev/null` } } | |
| 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
| Gem::Specification.new do |s| | |
| s.name = 'datetime_hack' | |
| s.version = '0.1.0' | |
| s.platform = Gem::Platform::RUBY | |
| s.author = 'Taylor Redden' | |
| s.email = '[email protected]' | |
| s.summary = 'DateTime Hack' | |
| s.description = "Allows you to split apart DateTime's into two variables for easy helpers in views." | |
| s.files = ['datetime_hack.rb'] |
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 strip_ids(array) | |
| array.each{ |row| row.reject! {|k, v| k =~ /_id/ } } | |
| end | |
| class Foo | |
| attr_accessor :array | |
| def initialize | |
| @array = [] | |
| @array << { :some_id => 1, :something => 'one' } |
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
| # | |
| # © 2009 Andrew Coleman | |
| # Released under MIT license. | |
| # http://www.opensource.org/licenses/mit-license.php | |
| # | |
| # total hack to allow american style date parsing. | |
| # does not allow european-ish date parsing, sorry. | |
| # | |
| # some credit from: | |
| # http://talklikeaduck.denhaven2.com/2009/04/26/ruby-1-9-compatibility-for-ri_cal-what-it-took-and-some-side-thoughts |
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
| class ActiveRecord::Base | |
| named_scope :company, lambda { { :conditions => ['company_id = ?', UserSession.find.user.company_id ] } } | |
| 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
| $(document).ready(function() { | |
| $("a").click(function() { | |
| if($('#admin_panel').val() != undefined) | |
| { | |
| admin_panel_left = $('#admin_panel').css('left') | |
| admin_panel_top = $('#admin_panel').css('top') | |
| href = $(this).attr('href'); | |
| admin_location = "admin_panel_left="+admin_panel_left+"&admin_panel_top="+admin_panel_top |
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
| $(document).ready(function(){ | |
| var top_post = 1 ; | |
| var bottom_post = 2 ; | |
| var post_length = $(".side-post").length; | |
| $("#timer_handle").everyTime(8000, function() { | |
| next_post = (bottom_post % post_length)+1; | |
| $("#"+top_post).queue(function () { | |
| $(this).hide("slow"); | |
| $("#"+next_post).show("slow"); | |
| $(this).dequeue(); |
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
| Work Motivation | |
| I. Introduction | |
| Motivation - an internal state that energizes, directs and sustains behavior | |
| Work Motivation - the amount of effort a person exerts to achieve a level of job performace | |
| Why do people get motivated? | |
| 1) fulfill unmet needs |