Skip to content

Instantly share code, notes, and snippets.

View easantillan's full-sized avatar
🏊‍♂️

Edgar Santillan easantillan

🏊‍♂️
View GitHub Profile
@easantillan
easantillan / beforeUnload.js
Created February 16, 2025 21:39 — forked from fjahn/beforeUnload.js
Block unload in Browser and Inertia Router using Vue
import { Inertia } from '@inertiajs/inertia'
import { onBeforeMount, onBeforeUnmount } from 'vue'
/**
* @param {() => boolean} shouldBlockUnload
* @param {string} message
* @returns void
*/
export function useBeforeUnload(
shouldBlockUnload,
@easantillan
easantillan / memo.md
Created May 13, 2024 06:19 — forked from kohheepeace/memo.md
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 !
@easantillan
easantillan / rails_new_options_help.md
Created April 28, 2024 02:27 — forked from kirillshevch/rails_new_options_help.md
List of "rails new" options to generate a new Rails 7 application

Run rails new --help to see all of the options you can use to create a new Rails application:

Output for Rails 7+

Usage:
  rails new APP_PATH [options]

Options:
      [--skip-namespace], [--no-skip-namespace]              # Skip namespace (affects only isolated engines)
@easantillan
easantillan / README.md
Created June 28, 2023 02:51 — forked from jesster2k10/README.md
Rails API Social Login

Rails API-Only Social Login

This is another piece of code I've extrapolated from a Ruby on Rails project I'm currently working on. The code implmenets social login with a RoR API-based application, targeted at API clients.

The setup does not involve any browser-redirects or sessions as you would have to use working with Omniauth. Instead, what it does is takes an access_token generated on client-side SDKs, retireves user info from the access token and creates a new user and Identity in the database.

This setup works with native applications as described in the Google iOS Sign In Docs (see Authenticating with a backend server)

@easantillan
easantillan / Capybara.md
Created September 11, 2022 06:14 — forked from tomas-stefano/Capybara.md
Capybara cheatsheet

Capybara Actions

# Anchor
click_link 'Save'

# Button
click_button 'awesome'

# Both above