Skip to content

Instantly share code, notes, and snippets.

"SELECT *, (fund_value / COALESCE((SELECT value FROM currency_rates \n WHERE currency_rates.date <= pifs_transactions.date AND \n currency_rates.curr_code = 'RUB' \n ORDER BY date DESC LIMIT 1), 1)) as fund_value_converted, (sumall / COALESCE((SELECT value FROM currency_rates \n WHERE currency_rates.date <= pifs_transactions.date AND \n currency_rates.curr_code = 'RUB' \n ORDER BY date DESC LIMIT 1), 1)) as sumall_converted, (mark / COALESCE((SELECT value FROM currency_rates \n WHERE currency_rates.date <= pifs_transactions.date AND \n currency_rates.curr_code = 'RUB' \n ORDER BY date DESC LIMIT 1), 1)) as mark_converted, (tax / COALESCE((SELECT value FROM currency_rates \n WHERE currency_rates.date <= pifs_transactions.date AND \n currency_rates.curr_code = 'RUB' \n
@Griminy
Griminy / get_time.rb
Created October 20, 2016 19:24
get local or some city's time
require 'gserver'
require 'socket'
require 'google_timezone'
require 'geokit'
require 'timezone'
class TimeServer < GServer
def initialize(port=3000, *args)
super(port, *args)
end
@Griminy
Griminy / application.scss
Last active February 22, 2016 11:09
login.html.erb
// #################################
.yllw-fullscreen-hero{
background-color: #eff3f6;
padding: 35px 40px;
padding-top: 35px;
padding-right: 40px;
padding-bottom: 35px;
padding-left: 40px;
border-radius: 5pt;
@Griminy
Griminy / true cod
Created May 12, 2015 13:55
some some some some
////////////////////////
require 'sidekiq'
require 'json'
require 'net/http'
require 'net/https'
require 'uri'
module MagazCore
class WebhooksWorker
module MagazCore
module ShopServices
class CreateEvent
include MagazCore::Concerns::Service
attr_accessor :event
def call(subject:, message:, description:, verb:)
@event = subject.events.new
MagazCore::Event.connection.transaction do
@Griminy
Griminy / gist:950086bbf149ee4be251
Created February 26, 2015 16:36
email_templates.yml
Templates:
abandoned_checkout_notification:
name: 'Abandoned Checkout Notification'
title: 'Complete your Purchase'
body: 'Your shopping cart has been reserved and is waiting for your return!'
template_type: 'abandoned_checkout_notification'
contact_buyer:
name: 'Contact Buyer'
title: 'Order with some stuff'
require 'test_helper'
module MagazCore
class ShopServices::CreateInviteTest < ActiveSupport::TestCase
include Rails.application.routes.url_helpers
setup do
@shop = create(:shop, name: 'shop_name')
@host = shop_name.magaz.local:3000
@email = '[email protected]'
end