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
def include_js_routes | |
script = "<script>window.Routes = {};" | |
Rails.application.routes.routes.each do |route| | |
script += "Routes.#{route.name}_path = function(params) {return $.buildPath('#{route.path}', params);};" | |
end | |
script += "</script>" | |
script.html_safe | |
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
def blank_safe value, guard = '<span class="NA">n/a</span>'.html_safe | |
value.presence || guard | |
end | |
alias bs blank_safe |
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
$.buildPath = (path, params...) -> | |
extraParams = {} | |
paramsHash = {} | |
if $.isPlainObject(lastParam = params.pop()) then paramsHash = lastParam | |
else params.push(lastParam) | |
$.each params, (_, value) -> | |
replacement = "/#{value}" | |
path = path.replace /\/:[\w_]+/, replacement |
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::Specification.new do |s| | |
s.name = 'assets_management' | |
s.version = '1.0.3' | |
s.platform = Gem::Platform::RUBY | |
s.author = 'Ivan Efremov' | |
s.email = 'st8998@hotmail.com' | |
s.summary = 'DB assets management utility' | |
s.description = 'DB assets management utility' | |
s.files = ['db_assets.rake', 'assets_management.rb', 'mp_postgresql_adapter.rb'] |
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 ResqueHelper | |
extend ActiveSupport::Concern | |
module InstanceMethods | |
def async(method, *args) | |
if Settings.async_processing | |
Resque.enqueue(self.class, id, method, *args) | |
else | |
self.reload.send method, *args |
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
source :rubygems | |
gem 'thin', :platform => :ruby | |
gem 'rack-uploads' |
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 Symbol | |
delegate :gt, :desc, :asc, to: :attr | |
def attr | |
attr = Arel::Attributes::Attribute.new | |
attr.name = self | |
attr | |
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
where_scope, order_scope = Arel::Builder.build do | |
tsvector = n(TsVector, language, n(ConcatWs, ' ', *columns)) | |
tsquery = n(Tsquery, language, n(ConcatWs, operator, *terms)) | |
rank_tsvector = tsvector | |
if options[:rank_columns].present? | |
rank_columns = options[:rank_columns].map {|n| t[n] } | |
rank_tsvector = n(TsVector, language, n(ConcatWs, ' ', *rank_columns)) | |
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
def try_to_pick_combination | |
zip_to_lookup = prepare_zip_to_decode | |
default_data = { | |
:country => country, | |
:state => state, | |
:raw_line_1 => raw_line_1, | |
:raw_line_2 => raw_line_2, | |
:raw_line_3 => raw_line_3, | |
:raw_zip => raw_zip, | |
:city => city |
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 define_helper name, force = false, &block | |
if !respond_to?(name) || force | |
self.class.send(:define_method, name) do |*args| | |
capture(*args, &block) | |
end | |
else | |
raise 'Your inline helper conflicts with already defined helper' | |
end |
OlderNewer