This file contains 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/environments/development.rb | |
require "net/smtp" # don't forget to add this first | |
# Try to sniff out if MockSMTP or MailCatcher is running | |
begin | |
smtp = Net::SMTP.start "localhost", 1025 | |
if smtp.started? | |
smtp.quit | |
puts ">> Emails WILL be sent to the SMTP server on port 1025" |
This file contains 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
# app/models/concerns/sluggable_model.rb | |
# | |
# https://gist.github.com/firedev/9701874 | |
# | |
# Usage: | |
# | |
# rails g migration addSlugToModel slug:string:uniq | |
# | |
# include SluggableModel | |
# attr_slug :title [, :slug] [, &block] |
This file contains 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/initializers/kaminari.rb | |
module Kaminari | |
module Helpers | |
class Paginator < Tag | |
def relevant_pages(options) | |
1..options[:total_pages] | |
end | |
class PageProxy |
This file contains 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
# spec/support/routing_helper.rb | |
class ActionDispatch::Routing::RouteSet::NamedRouteCollection::UrlHelper | |
def call(t, args) | |
t.url_for(handle_positional_args(t, args, { locale: nil }.merge( @options ), @segment_keys)) | |
end | |
end |
This file contains 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>name</key> | |
<string>Solarized (Firedev)</string> | |
<key>settings</key> | |
<array> | |
<dict> | |
<key>settings</key> |
This file contains 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
# application_controller.rb | |
class ApplicationController < ActionController::Base | |
before_action :make_action_mailer_use_request_host_and_protocol | |
def make_action_mailer_use_request_host_and_protocol | |
ActionMailer::Base.default_url_options[:protocol] = request.protocol | |
ActionMailer::Base.default_url_options[:host] = request.host_with_port | |
ActionMailer::Base.asset_host = "#{request.protocol}#{request.host_with_port}" | |
end |
This file contains 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
# Fixes https://github.com/amatsuda/kaminari/issues/133 | |
# put into /initializers/kaminari.rb | |
module Kaminari | |
module Helpers | |
class Paginator < Tag | |
class PageProxy | |
def inside_window? | |
if @options[:current_page] <= @options[:window] | |
@page <= (@options[:window] * 2) + 1 |
This file contains 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
# autoslug.rb | |
# | |
# Usage: | |
# | |
# include Autoslug | |
# attr_slug :title [, :slug] [, &block] | |
# | |
# Creates :slug from given :title when creating models if no :slug given | |
# Uses parameterize by default or can run :title through a &block: | |
# |