Skip to content

Instantly share code, notes, and snippets.

@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
}
@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

@gh639
gh639 / DydxFlashloanBase.sol
Created January 9, 2021 14:06
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&runs=200&gist=
pragma solidity 0.6.12;
pragma experimental ABIEncoderV2;
import { IERC20 } from "./Interfaces.sol";
import { SafeMath,SafeERC20 } from "./Libraries.sol";
import "./ISoloMargin.sol";
contract DydxFlashloanBase {
using SafeMath for uint256;
@jonathanroehm
jonathanroehm / Testing Your Gem Locally.md
Last active July 10, 2024 15:08
How to test a gem you're working on locally in your development host ruby on rails app

Setting up your bundle config to allow your host app to use the local version of your gem

What we don't want:

Having to test your gem on your host app after having to commit changes to your gem... and then having to rebundle your gemfile ... which forces you to refer to your gem-in-process like:

gem 'nfg_ui', git: 'https://github.com/network-for-good/nfg_ui', branch: 'feature/some_feature_branch_that_im_working_on'

And then have to:

$ bundle update gem_name`
@lucianomlima
lucianomlima / index.js
Last active January 17, 2023 13:35
Redux-saga Ajax API example
// ./app/sagas/index.js
import { all, takeLatest } from 'redux-saga/effects';
/* Services */
import api from '../services/api';
/* Redux Actions */
import { InitTypes } from '../redux/init';
import { UserTypes } from '../redux/user';
@kavirajk
kavirajk / gorm_joins.go
Created April 17, 2016 18:55
Understanding Joins in gorm
package main
import (
"fmt"
"log"
"github.com/jinzhu/gorm"
_ "github.com/lib/pq"
)