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
en: | |
religious: | |
- :name: Christian | |
:id: en.christian#[email protected] | |
- :name: Islamic | |
:id: en.islamic#[email protected] | |
- :name: Jewish | |
:id: en.jewish#[email protected] | |
national: | |
- :name: Australian |
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
if args['polygon'].present? | |
if (num = args['polygon'].match(/^(?:\-)?\d+$/)) && num[0].to_i > 0 && Polygon.exists?(num[0]) | |
event[:polygon_id] = args['polygon'] | |
else | |
event[:declared_polygon] = args['polygon'] | |
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
require 'i18n' | |
require 'arel' | |
module ModelTranslate | |
def self.included(base) | |
base.send :extend, Base | |
end | |
module Base | |
def translations *methods |
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 MemoryProfiler | |
class << self | |
DEFAULTS = {:delay => 10, :string_debug => false} | |
def start(opt={}) | |
opt = DEFAULTS.dup.merge(opt) | |
Thread.new do | |
prev = Hash.new(0) | |
curr = Hash.new(0) |
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
Benchmark.bm() do |x| | |
x.report { 1000000.times { %r(это медленно или быстро)i }} | |
x.report { 1000000.times { /это медленно или быстро\?/i }} | |
x.report { 1000000.times { Regexp.new('это медленно или быстро',true) }} | |
end | |
user system total real | |
0.050000 0.000000 0.050000 ( 0.047505) | |
0.050000 0.000000 0.050000 ( 0.047224) | |
12.010000 0.150000 12.160000 ( 12.169472) |
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
if [ -f $(brew --prefix)/etc/bash_completion ]; then | |
. $(brew --prefix)/etc/bash_completion | |
fi | |
# Customize BASH PS1 prompt to show current GIT repository and branch. | |
# by Mike Stewart - http://MediaDoneRight.com | |
# SETUP CONSTANTS | |
# Bunch-o-predefined colors. Makes reading code easier than escape sequences. | |
# I don't remember where I found this. o_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 create | |
@lead = params[:lead] | |
if @lead.save | |
respond_to do |format| | |
format.js | |
end | |
else | |
# handle errors here | |
end |