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
;;; pbcopy.el --- Emacs Interface to pbcopy | |
;; Copyright (C) 2011 Daniel Nelson, based on xclip.el, by Leo Shidai Liu | |
;; This file is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation; either version 3, or (at your option) | |
;; any later version. | |
;; This file is distributed in the hope that it will be useful, |
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 ImageWidget < ContentWidget | |
has_attached_file :image, | |
:styles => lambda { |a| | |
{ :thumb => '200x100>', | |
:display => "#{a.instance.width}x#{a.instance.height}#" } | |
}, | |
:storage => PAPERCLIP_CONFIG[:storage], | |
:bucket => PAPERCLIP_CONFIG[:bucket], | |
:s3_host_alias => PAPERCLIP_CONFIG[:bucket], |
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
The goal is for any url elaposentoalto.upperroom.org/abc to be redirected to elaposentoalto.upperroom.org/es/abc | |
The following correctly redirects elaposentoalto.upperroom.org to elaposentoalto.upperroom.org/es, and it correctly leaves elaposentoalto.upperroom.org/es alone. | |
However, it incorrectly redirects elaposentoalto.upperroom.org/es/devotional to elaposentoalto.upperroom.org/es/es/devotional. | |
with_es_subdomains = ['elaposentoalto'] | |
with_es_subdomains.each do |subdomain| | |
match "" => redirect("/es"), :constraints => { :subdomain => subdomain } | |
match "/:one" => redirect("/es/%{one}"), :constraints => { :subdomain => subdomain, :one => /([^e].*|e[^s].*|es.+)/ } |
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
no_es_subdomains = ['devotional'] | |
no_es_subdomains.each do |subdomain| | |
match "/es" => redirect(""), :constraints => { :subdomain => subdomain } | |
match "/es/*path" => redirect("/%{path}"), :constraints => lambda{ |req| req.host =~ /^#{subdomain}\./ && !(req.env["REQUEST_URI"] =~ /^es/) } | |
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
with_es_subdomains = ['elaposentoalto'] | |
with_es_subdomains.each do |subdomain| | |
match "" => redirect("/es"), :constraints => { :subdomain => subdomain } | |
match "/:one" => redirect("/es/%{one}"), :constraints => lambda{ |req| req.host =~ /^#{subdomain}\./ && !(req.env["REQUEST_URI"] =~ /^\/es$/) } | |
match "/:one.:format" => redirect("/es/%{one}.%{format}"), :constraints => lambda{ |req| req.host =~ /^#{subdomain}\./ && !(req.env["REQUEST_URI"] =~ /^\/es\./) } | |
match "/:one/*path" => redirect("/es/%{one}/%{path}"), :constraints => lambda{ |req| req.host =~ /^#{subdomain}\./ && !(req.env["REQUEST_URI"] =~ /^\/es\//) } | |
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
require 'spec_helper' | |
describe 'devotional redirect routing' do | |
it 'does not redirect elaposentoalto.upperroom.org/es' do | |
get 'http://elaposentoalto.upperroom.org/es' | |
response.status.should be(200) | |
end | |
it 'does not redirect elaposentoalto.upperroom.org/es/devotionals' do |
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
acts_as_authentic do |c| | |
c.login_field = :email | |
c.validate_login_field = false | |
c.merge_validates_format_of_email_field_options | |
c.merge_validates_length_of_password_confirmation_field_options | |
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 UrlHelper | |
def with_subdomain(subdomain) | |
subdomain = (subdomain || "") | |
subdomain += "." unless subdomain.empty? | |
[subdomain, request.domain, request.port_string].join | |
end | |
def url_for(options = nil) | |
if options.kind_of?(Hash) && options.has_key?(:subdomain) |
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 'spec_helper' | |
describe "create an account" do | |
before(:each) do | |
visit new_fulluser_registration_path | |
fill_in('fulluser_account_name', :with => 'peanuts') | |
fill_in('Email', :with => '[email protected]') | |
fill_in('Password', :with => 'mysecret') | |
fill_in('Password confirmation', :with => 'mysecret') | |
click_button('Sign up') |
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
config.use_transactional_fixtures = false | |
config.before(:suite) do | |
DatabaseCleaner.strategy = :truncation | |
end | |
config.before(:each) do | |
DatabaseCleaner.start | |
end |
OlderNewer