Skip to content

Instantly share code, notes, and snippets.

View kohheepeace's full-sized avatar

Kohhee Peace kohheepeace

View GitHub Profile
@kohheepeace
kohheepeace / database_migration_best_practices.md
Created October 27, 2023 01:19 — forked from HelioCampos/database_migration_best_practices.md
Database migration best practices for Rails

Database migration best practices for Rails

Never ever change data on schema changes! [1]

Use rake tasks to change the data! [1]

This decouples a deployment from completed migrations. Give us control of the data manipulation proccess by encapsulatin it in on place. need to remember to:

  1. Run it in one of the ways bellow: a. Add this rake task the deployment script or;
@kohheepeace
kohheepeace / application.rb
Created August 15, 2021 21:05 — forked from jasonayre/application.rb
Rails Dynamic Subdomain Constraint / Store Example
and dont forget
config.eager_load_paths << Rails.root.join('lib')
@kohheepeace
kohheepeace / memo.md
Last active June 19, 2021 05:15
prettier, eslint, lint-staged, husky setup
@kohheepeace
kohheepeace / readme.md
Last active June 20, 2021 01:03
Rails kaminari infinite scroll with pure(vanilla) js

Rails kaminari infinite scroll with pure(vanilla) js

Imgur

I wrote this gist because the official infinite scroll tutorial for the kaminari was outdated.

📌Create Rails App

Start by creating a new rails application.

@kohheepeace
kohheepeace / memo.md
Last active April 27, 2024 06:41
Rails ajax comparison (fetch, Rails.ajax, axios, @rails/request.js, Turbo)

Rails ajax comparison (fetch, Rails.ajax, axios, @rails/request.js, Turbo)

I wrote this gist because I felt that the Rails documentation was lacking a description of ajax requests.

📌 Options for ajax request

There are various ways to send ajax requests in Rails.

  1. Browser default Fetch API
  2. Rails.ajax (No Official docs and request for docs)
  3. http client like axios
  4. @rails/request.js 👈 I'm using this one now !
import React from 'react'
import { blue } from '@material-ui/core/colors'
export default class Iframe extends React.PureComponent {
componentDidMount () {
window.iframely && window.iframely.load()
}
getIframelyHtml = () => {
const { node } = this.props