Skip to content

Instantly share code, notes, and snippets.

View Unkas82's full-sized avatar

Timko Unkas82

  • Ukraine
View GitHub Profile
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 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)
class HardWorker
include Sidekiq::Worker
include Sidetiq::Schedulable
recurrence do
hourly(1)
end
def perform
uu = User.new
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 ProjectsController < ApplicationController
def index
get_index_records
if current_user.role.name == "expert"
@tiles = get_user_tiles
end
end
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
@Unkas82
Unkas82 / mailer
Created September 11, 2016 16:01
SimpleMailer#just_email: processed outbound mail in 153.0ms
Sent mail to [email protected] (7.1ms)
Date: Sun, 11 Sep 2016 21:59:30 +0300
From: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: Sample Email
Mime-Version: 1.0
Content-Type: text/html;
@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
$(".buhs").on "change paste keyup", (e) ->
thistable = this.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement
caseid = $(thistable).find('#case_id')[0].value
buysell = $(thistable).find('#buysell')[0].value
varcursum = $(this)[0].value
$.ajax '/render_alert_text',
type: 'GET'
data: {case_id: caseid, buysell: buysell, varcursum: varcursum }
dataType: 'text'
success: (data, textStatus, jqXHR) ->
class CasesController < ApplicationController
def index
@cases = Case.all
end
def show
@case = Case.find(params[:id])
@casepos_b = CasePosition.where(case_id: params[:id], buysell: "buyer")
@casepos_s = CasePosition.where(case_id: params[:id], buysell: "seller")
@casedoc_b = CaseDoc.where(case_id: params[:id], buysell: "buyer").order(:doctype)