This file contains hidden or 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 'sidekiq/capistrano' | |
load 'config/deploy/extensions/sidekiq' # required to be after require 'sidekiq/capistrano' | |
set :sidekiq_role, :sidekiq | |
role :sidekiq, 'server1.com', 'server2.com' | |
# you may use default syntax – same number of processes at all hosts | |
# set :sidekiq_processes, 1 | |
# or use hash notation to specify host-dependent number of processes |
This file contains hidden or 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
#!/usr/bin/env ruby | |
class Module | |
private | |
def delegate(*args) | |
dest, prefix = _extract_valid_delegation_options(args.pop) | |
_define_delegators(caller_locations.first, prefix, dest, args) | |
end |
This file contains hidden or 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 "mini_magick" | |
module MiniMagick | |
class Image | |
def get_dominant_color | |
color = run_command("convert", path, "-format", "%c\n", "-colors", 1, "-depth", 8, "histogram:info:").split(' '); | |
# color = " 1764000: (208,195,161) #D0C3A1 srgb(208,195,161)\n\n" | |
{ | |
hex: color[2], | |
rgb: color[1][1..-2].split(',') |
This file contains hidden or 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 FieldForm < Reform::Form | |
property :key | |
collection :field_options, form: FieldOptionForm | |
validation do | |
configure do | |
option :form # include this line if you want access to your form in predicates | |
config.messages_file = 'config/error_messages.yml' # if you define any custom predicates you must provide a message for them | |
This file contains hidden or 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
# src/{{app_name}}.cr | |
require "kemal" | |
require "./controllers/*" | |
alias Env = HTTP::Server::Context # this could be provided by Kemal | |
module Main | |
get "/", &->index(Env) | |
get "/:name", &->greet(Env) | |
end |
OlderNewer