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
| = javascript_include_tag "external/olark.onready" | |
| :javascript | |
| $(document).ready(function(){ | |
| if (typeof(olark) !== "undefined") { | |
| olark.identify('5955-991-10-7137'); | |
| olark("api.visitor.updateFullName", {fullName: "#{current_user.first_name} #{current_user.last_name}"}); | |
| olark("api.visitor.updateEmailAddress", {emailAddress: "#{current_user.email}"}); | |
| olark('api.chat.updateVisitorNickname', {snippet: "MY AWESOME CUSTOM NICK", hidesDefault: true}); | |
| } | |
| }); |
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
| RSpec::Matchers.define :include_javascript do |expected| | |
| match do |actual| | |
| actual && actual.match(/<script src="\/javascripts\/#{expected}\.js.+ type="text\/javascript"><\/script>/) | |
| end | |
| failure_message_for_should do |actual| | |
| "expected that javascript tag #{expected} would be present, but was not" | |
| 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
| = f.fields_for :questions do |question_form| | |
| - if question_form.object.needs_answer? | |
| %li | |
| = question_form.label :answer, question_form.object.decrypted_question | |
| = question_form.password_field :answer | |
| - question_form.object.encrypted_answer = SecurityQuestion::DIRTY_ANSWER | |
| = question_form.hidden_field :encrypted_answer |
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 time_queue_chomping(size = 10) | |
| if Resque.redis.llen("queue:robot_events").to_i > 0 | |
| puts "no way jose, the queue is full of junk!" | |
| return | |
| end | |
| Rails.application.config.logger.level = Logger::WARN | |
| ActiveRecord::Base.logger = ::Logger.new(StringIO.new) | |
| t0 = Time.now.to_i | |
| size.times { Resque.push("robot_events", :class => "RobotEventHandler", :args => [{:occurred_at => DateTime.now, :mailer => Mailer.first.attributes, :action => "fetch_top_line_data", :status => "success", :duration => "5", :response_queue => "ROBOT_EVENTS"}]) } | |
| printed = [] |
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 'active_record' | |
| require 'active_record/base' | |
| module ActiveRecord | |
| module ConnectionAdapters | |
| class Mysql2Adapter < AbstractAdapter | |
| def pk_and_sequence_for(table) #:nodoc: | |
| puts "!!!" | |
| keys = [] | |
| result = execute("SHOW CREATE TABLE #{quote_table_name(table)}", 'SCHEMA') |
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 ENV['PROFILE_LIKE_CRAZY'] | |
| config.before :each do | |
| $start = Time.now | |
| end | |
| config.after :each do | |
| p "#{example.description} spec ran in #{"%.2f" % (Time.now - $start)} seconds" | |
| 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
| <SCRIPT> | |
| $(function() { | |
| $( "#datepicker" ).datepicker(); | |
| }); | |
| </SCRIPT> | |
| <DIV class=demo> | |
| <P>Date: <INPUT id=datepicker></P></DIV><!-- End demo --> | |
| <DIV class=demo-description style="DISPLAY: none"> | |
| <P>The datepicker is tied to a standard form input field. Focus on the input (click, or use the tab key) to open an interactive calendar in a small overlay. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input's value.</P></DIV><!-- End demo-description --> |
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
| puts "factory id: #{@user.id}" | |
| User.destroy_all | |
| puts "factory id after destroyall : #{Factory(:user).id}" | |
| yields: | |
| factory id: 942334689 | |
| factory id after destroyall : 942334690 |
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 'rubygems' | |
| require 'rspec/core/rake_task' | |
| RSpec::Core::RakeTask.new(:quiet) do |t| | |
| t.verbose = false | |
| 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
| class User | |
| include Mongoid::Document | |
| references_many :sombreros, :inverse_of => :wearer, :class_name => "Hat" | |
| end | |
| class Hat | |
| references_in :wearer, :inverse_of => :sombreros, :class_name => "User", :stored_as => :array | |
| end | |
| User.sombreros uses a Mongoid::Criterio with an @selector querying the user_id. It should query for the wearer_id. |