defmodule InventoryCore.ProductForm do
import Ecto.Changeset
use Ecto.Schema
alias InventoryCore.Product
alias InventoryCore.SpreeProduct
alias InventoryCore.EbayProduct
embedded_schema do
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SUCCESS_MESSAGE="*<$BUILDS_URL$CI_BUILD_ID|$CI_BUILD_ID>* $CI_BUILD_REF_NAME\nТесты прошли" | |
ERROR_MESSAGE="*<$BUILDS_URL$CI_BUILD_ID|$CI_BUILD_ID>* $CI_BUILD_REF_NAME\nТесты упали" | |
function slack_message { | |
curl -i\ | |
-H "Accept: application/json" \ | |
-X POST --data 'payload={"channel": "'"$CHANNEL"'", "username": "'"$CI_USERNAME"'", "text": "'"$1"'", "icon_emoji": "'"$AVATAR"'"}' $WEBHOOK | |
} | |
function notify_success { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Item> | |
<Title>PRODUCTION SHIPPING</Title> | |
<SubTitle>pidrkoq111</SubTitle> | |
<Description>xml description</Description> | |
<HitCounter>BasicStyle</HitCounter> | |
<PrimaryCategory> | |
<CategoryID>10970</CategoryID> | |
</PrimaryCategory> | |
<StartPrice>312.0</StartPrice> | |
<CategoryMappingAllowed>true</CategoryMappingAllowed> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## a | |
```ruby | |
a = { :a => 1 } | |
``` | |
## b | |
``` | |
a = { :a => 1 } | |
``` |
I hereby claim:
- I am ssnickolay on github.
- I am ssnickolay (https://keybase.io/ssnickolay) on keybase.
- I have a public key ASBc6VrA_dnUD5REO-H2g62MLFP_c_U8X5Zk_mKeVvdrRQo
To claim this, I am signing this object:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
Record = Struct.new(:id, :level_1, :level_2) | |
class Tree | |
class Node | |
def initialize(object, records, behavior) | |
@object = object | |
@records = records | |
@behavior = behavior |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Based on https://github.com/StanfordSNR/gg/blob/master/docker/README.md | |
# install deps | |
apt-get install -y ruby bison | |
# clone Ruby | |
git clone --single-branch --branch ruby_2_6 https://github.com/ruby/ruby.git | |
cd ruby | |
# build configuration files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Filters | |
class Base | |
attr_reader :scope | |
def initialize(scope) | |
@scope = scope | |
end | |
end | |
class ByPrice < Base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def preload_association(records) | |
::ActiveRecord::Associations::Preloader.new.preload( | |
records, | |
@association_schema, | |
@preload_scope | |
).then(&:first).then do |preloader| | |
next unless @preload_scope | |
# The result of previous preload is memoized, ActiveRecord won't load this association again. | |
if preloader.is_a?(::ActiveRecord::Associations::Preloader::AlreadyLoaded) | |
owner = preloader.send(:owners).first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaseMutation < GraphQL::Schema::RelayClassicMutation | |
include Graphql::ResolverCallbacks | |
include ActionPolicy::GraphQL::Behaviour | |
def current_user | |
context[:current_user] | |
end | |
# Enforce mutation authorization. | |
# This callbacks verifies that `authorize!` method has been |
OlderNewer