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
module ActiveSupport | |
class BufferedLogger | |
module Severity | |
COLORIZE = 10 | |
end | |
include Severity | |
def add(severity, message = nil, progname = nil, &block) | |
return if @level > severity | |
message = (message || (block && block.call) || progname).to_s | |
message = "\e[0;45m#{message}\e[0;0m\n" if severity == 10 |
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
module ActiveSupport | |
class BufferedLogger | |
module Severity | |
COLORIZE = 10 | |
end | |
include Severity | |
def add(severity, message = nil, progname = nil, &block) | |
return if @level > severity | |
message = (message || (block && block.call) || progname).to_s | |
message = "\e[0;45m#{message}\e[0;0m\n" if severity == 10 |
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
# will look in db/seeds/admin_users.rb | |
plant :admin_users | |
# block syntax | |
plant :about_us do |seed| | |
seed.path = 'db/seeds/some_folder' | |
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
# addressable.rb | |
module Schemata | |
module Schema | |
def addressable | |
apply_schema :street_address_1, String | |
apply_schema :street_address_2, String | |
apply_schema :city, String | |
apply_schema :state, String | |
apply_schema :zip_code, String | |
apply_schema :country, String |
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
class MainController < ApplicationController | |
include Cable::Helpers::CableControllerHelpers | |
# def find_by_url | |
# unless request_is_missing_static_resource? | |
# @location = Location.includes(:menus).find_by_marketable_url( params[:url] ) || Location.includes(:menus).find_by_url( request.path ) | |
# unless @location.nil? | |
# @resource = @location.resource | |
# @page_title = (@location.title.nil?) ? "" : @location.title | |
# send(@location.special_action) unless @location.special_action.blank? | |
# @continue_execution = send(@location.special_action) unless @location.special_action.blank? |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery | |
before_filter :menus | |
def menus | |
@authors = Author.all | |
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
Model.where(:something => something, :call_date => start_date..end_date) |
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
class Order < ActiveRecord::Base | |
validate :ship_to_field | |
def ship_to_field | |
errors[:base] << "Please choose a shipping method" unless [true,false].include?(self.ship_to) | |
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
DOOOD NDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDN DOOOD | |
O***O D-------------------------------D O***O | |
O***O D-------------------------------D O***O | |
O*******O N88888888888O-------------------D O*******O | |
O*******O N88888888888O-------------------D O*******O | |
DOOO-$$$7***O DOOOOOOOOOOOO-------------------D O***7$$$-OOOD | |
O***$888$***O D-------------------------------D O***$888$***O | |
O***$888$***O D-------------------------------D O***$888$***O |
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
def serialize | |
h={} | |
self.instance_variables.each do |variab| | |
h[variab.gsub("@","").to_sym] = self.instance_variable_get(variab) | |
end | |
h | |
end |