Skip to content

Instantly share code, notes, and snippets.

View ivanovaleksey's full-sized avatar

Aleksey Ivanov ivanovaleksey

View GitHub Profile
require 'axlsx'
require 'batch_factory'
def off_balance?(count)
!(count =~ /^0\d\d/).nil? || !(count =~ /^\D/).nil?
end
keys = [:code, :name, :sub1, :sub2, :sub3]
skk = BatchFactory.from_file('skk.xlsx', keys: keys).drop(1)
# make_dump(){
# now=$(date +"%Y%m%d")
# pg_dump -Fc -U deployer -w mercury_production -f ~/manual_dumps/mercury_sa_$now.dump
# }
_pg_restore(){
if [[ -z $1 ]]; then
echo Database is not specified
return 0
fi
// XPath CheatSheet
// To test XPath in your Chrome Debugger: $x('/html/body')
// http://www.jittuu.com/2012/2/14/Testing-XPath-In-Chrome/
// 0. XPath Examples.
// More: http://xpath.alephzarro.com/content/cheatsheet.html
'//hr[@class="edge" and position()=1]' // every first hr of 'edge' class
load 'deploy'
# Uncomment if you are using Rails' asset pipeline
load 'deploy/assets'
load 'config/deploy' # remove this line to skip loading any of the default tasks
module DateScopes
extend ActiveSupport::Concern
module ClassMethods
def define_date_scopes(*scope_columns)
scope_columns.map(&:to_s).each do |column|
match_data = column.match(/^(.*)_at$/)
name = match_data ? match_data[1] : column