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
# This file is used by Rack-based servers to start the application. | |
require ::File.expand_path('../config/environment', __FILE__) | |
app = Rack::Builder.new do | |
map "/ping" do | |
run lambda { |_env| [200, {'Content-Type' => 'text/plain'}, ['pong']] } | |
end | |
map "/" do |
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
# Example usage: | |
# I18n.t("application.hello") | |
# I18n.t("hello", scope: "application") | |
# Application.t("hello") | |
# | |
# Application.t("missing") | |
# Error: translation missing: pl.application.missing | |
# | |
# I18n.locale = "ru" | |
# Application.t("hello") |
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
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) | |
require 'bundler/setup' | |
require "rails/commands/server" | |
Rails::Server.class_eval do | |
def default_options | |
super.merge(Port: 3000, Host: "127.0.0.1") | |
end | |
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
2.3.1 |
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
# Custom proxy cache server for assets speedup in *development* environment. | |
# | |
# Usage: | |
# Foreground (for tests): | |
# nginx -c $(pwd)/assets-nginx.conf -g 'daemon off; error_log stderr;' | |
# | |
# Background: | |
# nginx -c $(pwd)/assets-nginx.conf | |
# nginx -c $(pwd)/assets-nginx.conf -s <SIGNAL> | |
# signals: stop, quit, reopen, reload |
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
# encoding: utf-8 | |
# Source: https://gist.github.com/kml/da4f7cf70008986b3ba5 | |
# Issue: https://github.com/solnic/coercible/issues/16 | |
require "virtus/attribute/coercer" | |
# Coercible::Coercer::Object#to_string doesn't know how to coerce nil | |
# https://github.com/solnic/virtus/blob/master/lib/virtus/attribute/coercer.rb#L31 |
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
# encoding: utf-8 | |
# Source: https://gist.github.com/kml/349d3ae1716e6500cbee | |
# Benchmark: https://gist.github.com/kml/0fb1588fc1b6ba4c60fa | |
# Issue: https://github.com/solnic/coercible/pull/22 | |
# https://github.com/solnic/coercible/blob/master/lib/coercible/coercer/object.rb#L163 | |
require "coercible" | |
if Coercible::VERSION != "1.0.0" |
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
# encoding: utf-8 | |
# Usage: | |
# jruby coercible_coercer_object_method_missing_patch_bench.rb | |
# jruby coercible_coercer_object_method_missing_patch_bench.rb patch | |
# Issue: https://github.com/solnic/coercible/pull/22 | |
if $0 == __FILE__ | |
require "bundler/inline" |
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
# encoding: utf-8 | |
# Source: https://gist.github.com/kml/3395d73d874b0c302224 | |
# https://github.com/rails/rails/blob/3-2-stable/activesupport/lib/active_support/json/encoding.rb | |
require "active_support/json/encoding" | |
unless defined?(ActiveSupport::JSON::Encoding::CircularReferenceError) | |
abort "#{__FILE__}: CircularReferenceError is not defined. Remove this patch!" | |
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
# encoding: utf-8 | |
phrase = "sterownik".force_encoding("utf-8") | |
regexp = /(?i-mx:^bram[ay])|(?i-mx:(prz[e??]s[l??][ao]|element)[a-z??????]* ogrodz[a-z??????]*)|(?i-mx:(sterowniki?|automatyka).*\bbramy?)|(?i-mx:^tralk[ai])|(?i-mx:bojlery?|pojemno.ciow[ey])|(?i-mx:[a-z]+grzewacze? wody)/ | |
puts phrase.match(regexp).inspect | |
=begin | |
UTF8Encoding.java:35:in `length': java.lang.ArrayIndexOutOfBoundsException: 9 | |
from BaseUTF8Encoding.java:91:in `mbcToCode' |