Skip to content

Instantly share code, notes, and snippets.

View mmajorov's full-sized avatar

Michael Mayorov mmajorov

View GitHub Profile
# lib/liquid_i18n_rails.rb
module LiquidI18nRails
def t(string)
I18n.t(string.to_sym)
end
end
# config/initializers/liquid.rb
require 'liquid_i18n_rails'
Liquid::Template.register_filter LiquidI18nRails
@mmajorov
mmajorov / gist:da6e3834623e5295d6ae
Created July 22, 2014 13:24
Rails http status codes symbols
100 = :continue
101 = :switching_protocols
102 = :processing
200 = :ok
201 = :created
202 = :accepted
203 = :non_authoritative_information
204 = :no_content
205 = :reset_content
206 = :partial_content
(echo flushall && sleep 1 ) | telnet localhost 6379
#!/usr/bin/env puma
# {{ ansible_managed }}
environment ENV['RAILS_ENV'] || 'production'
directory "{{ puma_directory }}"
rackup "{{ puma_rackup }}"
pidfile "{{ puma_pidfile }}"
{% for typ,v in puma_binds.iteritems() %}
CREATE OR REPLACE VIEW v_clients_requests_loans
AS
SELECT
req.id,
req.store_id,
req.client_id,
IFNULL(clients.initial_total_loan_limit > 0 OR clients.total_loan_limit > 0, 0) AS client_limit,
clients.mobile_phone AS client_phone,
DATE_ADD(req.created_at, INTERVAL 3 HOUR) AS created_at,
DATE_ADD(req.updated_at, INTERVAL 3 HOUR) AS updated_at,