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
<?php | |
function gravatar_from_email($email, $size = '50', $rating = 'g', $default = null, $alt = null, $class = null) | |
{ | |
return img(array( | |
'src' => 'http://gravatar.com/avatar/'.md5( strtolower( trim( $email ))).'?'.($rating != null ? '&r='.$rating : '').($size != null ? '&s='.$size : '').($default != null ? '&d='.$default : ''), | |
'alt' => $alt, | |
'class' => $class |
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 'omniauth' | |
gem 'omniauth-facebook' | |
gem 'clearance' |
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 DoorCore | |
def initialize(min_width, max_width, min_height, max_height) | |
@width = max_width - min_width | |
@height = max_height - min_height | |
@ratio = @height / @width | |
end | |
attr_accessor :width, :height, :ratio | |
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 Friendship < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :friend, :class_name => "User" | |
def self.feeling_mutual? user_id, friend_id | |
return true if find_by(user_id: user_id, friend_id: friend_id) && find_by(friend_id: friend_id, user_id: user_id) | |
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
module ApplicationHelper | |
def title(page_title) | |
content_for(:title) { page_title.html_safe } | |
end | |
def smaller_page(c = nil) | |
content_for(:smaller_page) { 'slim' } unless c.nil? | |
end | |
def no_mobile_sidebar(c = 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
class DoorCore | |
def initialize(input_width) | |
@min_height = 2120.to_f | |
@max_height = 2455.to_f | |
@min_width = 915.to_f | |
@max_width = 1080.to_f | |
@input_width = input_width | |
end | |
def predicted_max_height |
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
# lib/account_detector.rb | |
class AcountDetector | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
account = Club.find_by custom_domain: env["HTTP_HOST"] | |
if account |
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
# PostgreSQL. Versions 8.2 and up are supported. | |
# | |
# Install the pg driver: | |
# gem install pg | |
# On OS X with Homebrew: | |
# gem install pg -- --with-pg-config=/usr/local/bin/pg_config | |
# On OS X with MacPorts: | |
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config | |
# On Windows: | |
# gem install pg |
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 product.has_colours? && (product.type_name.parameterize == 'fire-smoke' || product.type_name.parameterize == 'fire-only') %> | |
<div class="extended"> | |
<h4>Colours:</h4> | |
<ul class="colours"> | |
<% product.all_colours.each do |c| %> | |
<%= content_tag :li, c, class: c.parameterize, alt: c, title: c %> | |
<% end %> | |
</ul> | |
</div> | |
<% 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
<%= content_tag :li, class: product.primary_collection.to_param do %> | |
<%= link_to collection_product_path(product.primary_collection, product) do %> | |
<div class="thumbnail"> | |
<%= product_thumbnail(product) %> | |
</div> | |
<div class="summary"> | |
<h3><%= product.name %></h3> | |
<p class="type"><%= product.type_name %></p> | |
<% if product.manufacturer_name.present? %> |
OlderNewer