Skip to content

Instantly share code, notes, and snippets.

View skatkov's full-sized avatar
🏠
Working from home

Stanislav (Stas) Katkov skatkov

🏠
Working from home
View GitHub Profile
require "yaml"
require "json"
require "tempfile"
module RuboCopAutoCollrect
class << self
def run_all!(targets, *cop_names, commit_log_format:, fixup_commit_log_format:)
plan(targets, *cop_names).each do |cop_name|
run!(targets, cop_name, commit_log_format: commit_log_format)
end
@lazaronixon
lazaronixon / _form.html.erb
Last active June 6, 2025 19:24
Dropzone.js + Stimulus + Active Storage + CSS Zero (2025)
<%= form_with(model: billboard) do |form| %>
<%= tag.div class: "dropzone", data: { controller: "dropzone", dropzone_param_name_value: "billboard[images][]", dropzone_url_value: rails_direct_uploads_url, dropzone_accepted_files_value: "image/*", dropzone_max_files_value: 3, dropzone_max_filesize_value: 0.300 } do %>
<div class="dz-default dz-message flex flex-col items-center">
<%= image_tag "upload.svg", size: 28, class: "colorize-black", aria: { hidden: true } %>
<h5 class="font-semibold mbs-4">Drop files here or click to upload.</h5>
<p class="text-sm text-subtle">Upload up to 10 files.</p>
</div>
<% end %>
<div class="inline-flex items-center mbs-2 mie-1">
@nicolas-brousse
nicolas-brousse / 01_README.md
Last active January 13, 2023 23:04
Rails health check

HealthCheck

Install

Add the following line to your Gemfile

gem "server_health_check-rails"
@marckohlbrugge
marckohlbrugge / wip_graphql_demo.rb
Last active October 10, 2022 11:46
Ruby example of creating a todo and then completing it using wip.co graphql.
# NOTE: Be sure to set the API key further down in the code!
require "net/http"
require "uri"
require "json"
class WIP
def initialize(api_key:)
@api_key = api_key
end
@pftg
pftg / .circleci-config.yml
Created December 1, 2017 02:09
Typical pronto setup for Ruby on Rails + GitHub + CircleCI 2.0
# .circleci/config.yml
version: 2
jobs:
lint:
environment:
- BUNDLE_GEMFILE: Gemfile.tools
docker:
# specify the version you desire here
- image: circleci/ruby:2.4.2-stretch-node-browsers
environment:
# EC2 available volumes
aws ec2 describe-volumes \
--filter Name=status,Values=available \
--query "Volumes[].[VolumeId,Size,CreateTime,Tags[?Key=='Name'].Value|[0]]" \
--output text
# EC2 stopped instances
aws ec2 describe-instances \
--filter Name=instance-state-name,Values=stopped \
--query "Reservations[].Instances[].[InstanceId,InstanceType,LaunchTime,Tags[?Key=='Name'].Value|[0]]" \
@haqHUB
haqHUB / delayed-retargeting.js
Created August 20, 2017 13:43 — forked from rsiddle/delayed-retargeting.js
Hide Retargeting Cookies (Delayed Scripts)
/*
Description
Using the window.setTimeout function will allow you to hide retargeting cookies and execute them after 45 seconds.
This helps provide higher quality leads/audience. The example below shows Facebook's pixel tracker.
It could be used for other pixel tracking services too.
Case Study @ http://imscalable.com/blog/case-study-retargeting-done-wrong/
*/
// Facebook Code
rubocop -a `git diff --name-only --cached | grep '\.rb'`
@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active October 17, 2025 13:03
Hyperlinks in Terminal Emulators
@palkan
palkan / aggregate_failures.rb
Created March 28, 2017 16:54
Rubocop: RSpec/AggregateFailures
require 'rubocop/rspec/language'
module RuboCop
module Cop
module RSpec
class AggregateFailures < RuboCop::Cop::Cop
GROUP_BLOCKS = RuboCop::RSpec::Language::ExampleGroups::ALL
EXAMPLE_BLOCKS = RuboCop::RSpec::Language::Examples::ALL
def on_block(node)