Skip to content

Instantly share code, notes, and snippets.

View DimaSamodurov's full-sized avatar
🇺🇦
Stand With Ukraine

Dmytro Samodurov DimaSamodurov

🇺🇦
Stand With Ukraine
  • EPAM
  • Lviv, Ukraine
View GitHub Profile
@kostyay
kostyay / Caddyfile
Created April 16, 2024 20:47
Rails app with Postgres and Caddy on Hetzner VPS with Docker Compose
{
email [email protected]
}
my.host.com {
encode zstd gzip
log {
output stdout
}
@hopsoft
hopsoft / 00_do_stuff_job.rb
Last active September 13, 2024 15:03
ActiveJob as Service Worker
# ActiveJob natively captures constructor arguments in an `@arguments` instance variable
# which is also exposed as an `arguments` property on each job instance.
#
# Calls to `perform_now` and `perform_later` both forward arguments to the constructor.
#
# For example, all of these invocation styles work.
#
# result = DoStuffJob.new("foobar").perform # sync
# result = DoStuffJob.new.perform("foobar") # sync
# result = DoStuffJob.perform_now("foobar") # sync
@hopsoft
hopsoft / README.md
Last active March 29, 2024 18:13
Descriptive messages with basic asserts

Descriptive messages with basic asserts

What if I told you that it's possible to get helpful failure messages from basic asserts using idiomatic equality == checks? No DSLs in sight.

This is a proof of concept to demonstrate that it's possible... mostly to satisfy my own curiosity. The concepts here could theoretically be expanded to provide a useful extension to existing testing frameworks or perhaps lay a foundation for an entirely new one.

This experiment created with Ruby 3.0.1. Note to self: There's probably a way to do this with TracePoint instead of monkey patching but I couldn't figure out how to get a reference to the passed variable being compared.

Examples:

@hopsoft
hopsoft / Dockerfile
Last active May 17, 2023 19:58
Dockerize your Rails app
FROM ruby:3.0-alpine
RUN apk add --no-cache --update \
ack \
bash \
build-base \
curl \
git \
htop \
less \
@kylekeesling
kylekeesling / flatpickr_input.rb
Created January 2, 2021 14:48
A Simple Form custom input using stimulus-flatpickr and Bootstrap
# frozen_string_literal: true
class FlatpickrInput < SimpleForm::Inputs::StringInput
def input(wrapper_options)
template.content_tag(:div, class: "input-group",
data: {controller: "flatpickr", flatpickr_disable_mobile: true}) do
template.concat input_addon(calendar_button, data: {toggle: true})
template.concat @builder.text_field(attribute_name, input_html_options)
template.concat input_addon(close_button, data: {clear: true})
end
@BjornDCode
BjornDCode / gist:5cb836a6b23638d6d02f5cb6ed59a04a
Created February 3, 2020 11:58
Tailwind - Fixed sidebar, scrollable content
// Source: https://twitter.com/calebporzio/status/1151876736931549185
<div class="flex">
<aside class="h-screen sticky top-0">
// Fixed Sidebar
</aside>
<main>
// Content
</main>
@bbonamin
bbonamin / Brewfile
Last active August 18, 2024 09:26
Capybara Selenium Webdriver: Headless Chrome (with file downloads!) & Headless Firefox
tap "caskroom/cask"
cask "google-chrome"
cask "firefox"
brew "chromedriver"
brew "geckodriver"
@renatosousafilho
renatosousafilho / Dockerfile
Last active February 8, 2021 00:38
Deploy com Mina, Docker e Docker Compose
FROM rails:4.2.3
MAINTAINER Renato Filho <[email protected]>
ENV HOME /home/app
ENV RAILS_ENV development
RUN useradd -m -s /bin/bash app
RUN gem install -N bundler
@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active November 18, 2024 08:50
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."[email protected]:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@oanhnn
oanhnn / using-multiple-github-accounts-with-ssh-keys.md
Last active November 18, 2024 19:17
Using multiple github accounts with ssh keys

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.