Skip to content

Instantly share code, notes, and snippets.

View Unkas82's full-sized avatar

Timko Unkas82

  • Ukraine
View GitHub Profile
@Unkas82
Unkas82 / case
Last active September 9, 2016 15:51
case
#binding.pry
when ([1, 2].include? cd.doctype) && (current_user.role_id == 1) && (cd.buysell == "buyer")
true
when ([1, 2].include? cd.doctype) && (current_user.role_id == 2) && (cd.buysell == "seller")
true
when ([3, 4].include? cd.doctype) && (current_user.role_id == 3)
true
else
false
@Unkas82
Unkas82 / mailer
Created September 11, 2016 16:01
SimpleMailer#just_email: processed outbound mail in 153.0ms
Sent mail to tim99x71@yandex.ru (7.1ms)
Date: Sun, 11 Sep 2016 21:59:30 +0300
From: from@example.com
To: tim99x71@yandex.ru
Message-ID: <57d5a9929ea5e_57252af8281d3ae43837a@unkas-pc.mail>
Subject: Sample Email
Mime-Version: 1.0
Content-Type: text/html;
unkas@unkas-pc:~/WORK/RAILS/ERP$ git push heroku master
Counting objects: 27, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (27/27), done.
Writing objects: 100% (27/27), 3.85 KiB | 0 bytes/s, done.
Total 27 (delta 18), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
class ProjectsController < ApplicationController
def index
get_index_records
if current_user.role.name == "expert"
@tiles = get_user_tiles
end
end
def svernut dimensions, resources
gruppen = self.group_by{|e|[ dimensions.map{|dim| e.send(dim)} ]}
output_array = []
gruppen.each do |row|
row_hash = Hash.new(0)
dimensions.map{|dim| row_hash[dim] = row.second.first.send(dim) }
row.second.each do |elem|
resources.each do |res|
class HardWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence do
hourly(1)
end
def perform
uu = User.new
class HardWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence do
hourly.minute_of_hour(21, 22, 23, 24, 25, 26, 27, 28, 29, 30)
end
def perform
#self.class.perform_in(2.minutes)
def self.total pricing_rules
items = BasketRow.all
gruppen = items.group_by(&:product_id)
output_array = []
gruppen.each do |row|
row_hash = Hash.new(0)
row_hash[:product_id] = row.first
class StasProc3 < ActiveRecord::Migration
def up
connection.execute(%q{
CREATE OR REPLACE FUNCTION boxscore_ask_match_events (_p_match_id bigint, _p_half int DEFAULT 0::int) RETURNS TABLE(
f_match BIGINT
,id BIGINT
,half SMALLINT
,second real
,second_clear real