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
name: Content System | |
on: | |
push: | |
branches: | |
- master | |
- develop | |
- staging | |
pull_request: |
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
repair_nested_params({id: '11', age: '25'}) # Sample | |
def repair_nested_params(obj) | |
obj.each { |key, value| obj[key] = parse_value(value) } | |
end | |
def parse_value(value) | |
return repair_nested_params(value) if value.is_a?(Hash) | |
return value.map(&method(:parse_value)) if value.is_a?(Array) | |
return value unless value.is_a?(String) |
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
# frozen_string_literal: true | |
# config/initializers/delayed_job_ext.rb | |
# unique jobs across workers | |
# Sample: my_model.delay(across_uniq_key: 'article-19').create | |
# Sample: my_model.delay(across_uniq_key: 'article-19').update | |
# Sample: my_model.delay(across_uniq_key: 'article-19').destroy | |
# ==> the jobs will be processed in serial, not in parallel: | |
# can not call update before create or run both at the same time | |
Delayed::Job.class_eval 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
#/themes/e_shop/views/custom_field/_my_slider.html.erb | |
<div class="group-input-fields-content" data-callback-render="render_my_custom_slider"> | |
<div class="form-group"> | |
<label>Image:</label> | |
<div class="input-group"> | |
<input data-dimension="<%= field.options[:dimension] %>" data-versions="<%= field.options[:versions] %>" data-thumb_size="<%= field.options[:thumb_size] %>" type="url" name="<%= field_name %>[<%= field.slug %>][values][][image]" class="data-error-place-parent image_field form-control <%= "required" if field.options[:required].to_s.to_bool %>"/> | |
<span class="input-group-addon btn_upload" onclick="load_upload_image_field($(this).prev());"><i class="fa fa-upload"></i> <%= t('camaleon_cms.admin.button.upload_image')%> <%= "(#{field.get_option('dimension')})" if field.get_option('dimension').present? %></span> | |
</div> | |
</div> | |
<div class="clearfix"> |
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
# frozen_string_literal: true | |
require 'sidekiq/api' | |
module UniquenessJob | |
extend ActiveSupport::Concern | |
included do | |
class << self | |
alias_method :client_push_old, :client_push | |
def client_push(item) |
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
gem 'multiple_man' | |
gem 'bunny-mock' |
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
--- | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
env: &env_vars | |
val1: "val1" | |
val2: "val2" | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Service | |
env: |
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
# required python 3 | |
# command: python <location_of_the_file>/secrets_generator.py --env <path_to_env_var_file> --name <secrets_name> | |
#sample: python ./secrets_generator.py --env .env --name my_secrets | |
import copy | |
import argparse | |
import sys | |
import configparser | |
import itertools | |
import base64 | |
from string import Template |
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
# | |
# Converts multidimensional array into one-dimensional array | |
# @param array_data [Array]: Multidimensional array to be converted into one-dimensional array | |
# @param res [Array]: Internal param control (ignore it) | |
# @sample 1: flatten([1,2,[3,4]]) => [1,2,3,4] | |
# @sample 1: flatten([1,2,[3,4], [[5], [6, [7]]]]) => [1,2,3,4] | |
# @return [Array] Returns a new array that is a one-dimensional | |
def flatten(array_data, res = []) | |
array_data.each{|v| v.is_a?(Array) ? flatten(v, res) : res.push(v) } | |
res |
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
#Take it line by line | |
pending_line = [] | |
query_end = ');' # take care with insert content's ending with ");" | |
ARGF.each do |line| | |
# fix for: mapping values are not allowed in this context at (content used by rails for serialized model attributes) | |
if line.start_with?('INSERT INTO') && !line.strip.end_with?(query_end) | |
pending_line = [line.gsub("\n", '')] | |
next | |
end | |
if pending_line.length > 0 && !line.strip.end_with?(query_end) |