Skip to content

Instantly share code, notes, and snippets.

@Coridyn
Coridyn / README.md
Created July 11, 2024 08:48 — forked from jesster2k10/README.md
JWT Auth + Refresh Tokens in Rails

JWT Auth + Refresh Tokens in Rails

This is just some code I recently used in my development application in order to add token-based authentication for my api-only rails app. The api-client was to be consumed by a mobile application, so I needed an authentication solution that would keep the user logged in indefinetly and the only way to do this was either using refresh tokens or sliding sessions.

I also needed a way to both blacklist and whitelist tokens based on a unique identifier (jti)

Before trying it out DIY, I considered using:

@Coridyn
Coridyn / rails http status codes
Created July 10, 2024 04:18 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@Coridyn
Coridyn / memo.md
Created April 27, 2024 06:28 — 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 !
@Coridyn
Coridyn / LazyTippy.jsx
Created February 9, 2023 02:10 — forked from atomiks/LazyTippy.jsx
Lazy Tippy
// Will only render the `content` or `render` elements if the tippy is mounted to the DOM.
// Replace <Tippy /> with <LazyTippy /> component and it should work the same.
const LazyTippy = forwardRef((props, ref) => {
const [mounted, setMounted] = useState(false);
const lazyPlugin = {
fn: () => ({
onMount: () => setMounted(true),
onHidden: () => setMounted(false),
@Coridyn
Coridyn / info.md
Created September 24, 2017 03:17
Webpack + TypeScript + Vue

2017-09-24

Build Vue with template compiler

Make sure you have the vue$ alias in webpack.config.js:

{
    resolve: {
 alias: {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<script>
document.addEventListener('DOMContentLoaded', function(){
document.querySelector('#frame').srcdoc = document.querySelector('#frameContent').innerHTML;
@Coridyn
Coridyn / sassc-ruby windows installation.md
Last active September 26, 2018 12:58
How to compile and install the sassc-ruby gem on Windows

Windows installation

This will install SassC Ruby gem on Windows.

  1. Download and install Ruby 2 (http://rubyinstaller.org/downloads/)
  2. Download and install the ruby development kit (http://rubyinstaller.org/downloads/) (for the rest of the document, assuming it's installed into c:\devkit\)
  3. Download the libdl library for Windows (https://github.com/dlfcn-win32/dlfcn-win32) Go to releases and download the most recent precompiled version.
  4. Extract the libdl package into your development kit mingw directory:
var XHR = window.XMLHttpRequest || function() {
try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); } catch (e1) {}
try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); } catch (e2) {}
try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e3) {}
try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e4) {}
throw new Error("This browser does not support XMLHttpRequest.");
}, XDR = !window.msPerformance && isIE () != 10 && window.XDomainRequest || null;
/**
Install Ruby:
https://rvm.io/rvm/install
Install node with homebrew:
http://thechangelog.com/install-node-js-with-homebrew-on-os-x/
Turn on colours in iTerm2
http://superuser.com/questions/399594/color-scheme-not-applied-in-iterm2
@Coridyn
Coridyn / PixelBender-XOR.pbk
Created September 9, 2014 02:22
Bitwise XOR two images in PixelBender
<languageVersion : 1.0;>
kernel Crossfade
< namespace : "AIF";
vendor : "Coridyn - https://github.com/Coridyn";
version : 2;
description : "Perform a bitwise XOR of two images"; >
{
input image4 inputImage;
input image4 diffImage;