Skip to content

Instantly share code, notes, and snippets.

View johnreilly's full-sized avatar

John Reilly johnreilly

View GitHub Profile
# HTML5 style data-* attributes in haml
def test_html5_data_attributes
assert_equal("<div data-author_id='123' data-biz='baz' data-foo='bar'></div>\n",
render("%div{:data => {:author_id => 123, :foo => 'bar', :biz => 'baz'}}"))
assert_equal("<div data-one_plus_one='2'></div>\n",
render("%div{:data => {:one_plus_one => 1+1}}"))
assert_equal("<div data-foo='Here&apos;s a \"quoteful\" string.'></div>\n",
render(%{%div{:data => {:foo => %{Here's a "quoteful" string.}}}}))
I'll throw a +1 in this as well. Here's the somewhat convoluted situation we have:
Anyone can send us emails at support@ourcompany.com, and ZD tickets are created from that email. This works great.
We wrote a SSO app that takes advantage of ZD's remote authentication and API features. Our customers can sign up and
log into our site, and check the status of their tickets that were created from our site, or from emails they sent in.
This also works great.
But... I've seen several instances of customers signing up to our SSO app using one email address (user@work.com), and
then sending in email tickets from a different email address (user@home.com). From ZD's perspective, these are
# Small bug in factory_girl running under rails 3 beta.
# Given a model:
class Thing < ActiveRecord::Base
# has a 'name' attribute
end
# These factory definitions work great.
Factory.define :thing do |thing|
thing.sequence(:name) { |n| "user#{n}" }
DEBUG: Executing ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml
DEBUG: ---- Begin output of ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml ----
DEBUG: STDOUT:
DEBUG: STDERR:
DEBUG: ---- End output of ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml ----
DEBUG: Ran ln -nfs /data/my_trms_com/shared/config/keep.database.yml /data/my_trms_com/releases/20090903185551/config/database.yml returned 0
DEBUG: Executing ln -nfs /data/my_trms_com/shared/config/database.yml /data/my_trms_com/releases/20090903185551/config/database.yml
DEBUG: ---- Begin output of ln -nfs /data/my_trms_com/shared/config/database.yml /data/my_trms_com/releases/20090903185551/config/database.yml ----
DEBUG: STDOUT:
class User < ActiveRecord::Base
# Columns:
# id, integer
# my_id, string
# etc...
has_one :contact, :primary_key => "my_id", :foreign_key => "my_id"
end
class Contact < ActiveRecord::Base
Broken:
----------------------------------
def self.url(key, secret, email, name, uid, additional_fields={})
consumer = OAuth::Consumer.new(key, secret)
uri = URI.parse("https://#{DOMAIN}/fastpass")
...
end
Generates this url:
https://getsatisfaction.com/fastpass?email=jr%2Btrmstest%40trms.com&name=trmstest&oauth_consumer_key=rakdrg10995k&oauth_nonce=vbS27Iv3jhThzbgyCahirBi1cuyjeeqcDKSYn2YY&oauth_signature=doYBa7WzSPnwzeWmAqiH%2Frr3e3M%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1249576107&oauth_version=1.0&phone=866-866-4118&real_name=trmstest&uid=85295e67
#City#
Saint Paul
#Country#
USA
#Currently#
Cloudy
#CurrentIconUrl#
Multiple definition of element '[REDACTED]' causes the content model
to become ambiguous. A content model must be formed such that during
validation of an element information item sequence, the particle
contained directly, indirectly or implicitly therein with which to
attempt to validate each item in the sequence in turn can be uniquely
determined without examining the content or attributes of that item,
and without any information about the items in the remainder of the
sequence.
### Get rid of unneeded files
["./tmp/pids", "./tmp/sessions", "./tmp/sockets", "./tmp/cache"].each do |f|
run("rmdir #{f}")
end
["./README", "./doc/README_FOR_APP", "./public/index.html", "./public/favicon.ico", "./public/images/rails.png", "./public/robots.txt"].each do |f|
run("rm #{f}")
end
### Don't ignore empty directories
51ea2a120343f32750f4a4ca98ef91b14ac38af6f82f40fd16b9c997d4a4239d87051237f770ef5327f0f89b15193fdabf2f6d6a229d56a220d9617653344700b4b548764a53ca25da75fcad62bfebea3dd0d99a8e7cbce3d256db02b002685cd99713b96861f784b06a1243590dc944eda1cbb869f2393511a4f6387381903b