Skip to content

Instantly share code, notes, and snippets.

View alec-c4's full-sized avatar
🪓
I do make sacrifices to Odin

Alexey Poimtsev alec-c4

🪓
I do make sacrifices to Odin
View GitHub Profile
# Usage:
#
# class Post < ApplicationRecord
# include HasNanoid
# has_nanoid
# end
#
module HasNanoid
extend ActiveSupport::Concern
@yapus
yapus / app.jsx
Created October 21, 2024 05:04
rails7-vite - vite-plugin-pwa
// file: app/frontend/entrypoints/app.jsx
import { render } from 'solid-js/web'
import App from '@/components/App'
import '@/utils/pwa'
const app = document.getElementById('app')
if (app) {
render(
() => <App />,
app
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active April 30, 2025 20:29
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Want more content like this, for free? Check out my free book, RailsAI!

Alt Text

@davidteren
davidteren / nerd_fonts.md
Last active May 10, 2025 11:30
Install Nerd Fonts via Homebrew [updated & fixed]
@KonnorRogers
KonnorRogers / environment.js
Last active July 12, 2024 22:42
ESBuild with Webpacker < 6 in Rails. Bye Babel <3
// DONT FORGET TO `yarn add esbuild-loader` !!!
// config/webpacker/environment.js
const { environment } = require('@rails/webpacker')
const { ESBuildPlugin } = require('esbuild-loader')
const esBuildUse = [
{
loader: require.resolve('esbuild-loader'),
// What you want to compile to, in this case, ES7
@dancheskus
dancheskus / traefik.md
Last active March 18, 2025 06:42
Traefik, как обратный прокси в Docker (пример с 2 react проектами)

Traefik, как обратный прокси в Docker (пример с 2 react проектами)

В результате будет 2 react проекта на 1 сервере доступных по разным ссылкам

Цели

  • Запустить traefik в одном контейнере
  • Запустить другие проекты в других контейнерах
  • Соединить все контейнеры в одну docker cеть
  • Настроить контейнеры с проектами так, что-бы они объясняли traefik'у, какие url ведут на конкретный проект
@dpaluy
dpaluy / trix_shrine.md
Last active July 20, 2023 01:25
Trix and Shrine for WYSIWYG

How to use Trix and Shrine for WYSIWYG Editing with Drag-and-Drop Image Uploading

Building It

Install and Configure Shrine and Trix Dependencies

  1. Setup Shrine:

First, add the Shrine gem to your application's Gemfile:

@bjeanes
bjeanes / migrate_from_devise.rb
Last active November 1, 2023 12:52
Rodauth feature to migrate from Devise, including maintaining all Devise columns (that I was using) in case a rollback was necessary (it wasn't)
# frozen_string_literal: true
require 'rodauth'
# In order for Rails to reload this constant in dev, we need `require_dependency` because Rodauth expects the features
# in a specific load path, but it defines a constant against Rails' expectations, which breaks reloading.
require_dependency 'rodauth/features/remote_ip'
module Rodauth
Feature.define(:migrate_from_devise, :MigrateFromDevise) do
@maxivak
maxivak / _0__ssl_certbot_letsencrypt.md
Last active February 26, 2025 14:31
Let's encrypt SSL certificates using certbot in docker

Directories on host machine:

  • /data/certbot/letsencrypt

  • /data/certbot/www

  • Nginx server in docker container

docker run -d --name nginx \
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active May 14, 2025 07:39
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.