Skip to content

Instantly share code, notes, and snippets.

View GeorgeDettmer's full-sized avatar

George GeorgeDettmer

  • Leicester, United Kingdom
View GitHub Profile
@jer-k
jer-k / _1-README.md
Last active December 29, 2024 01:54
Setting up Zero with Ruby on Rails (session based auth) and Next.js

Reading through the Zero docs on authentication, I saw that JWT authentication was all that was supported (for now). I'm building a project using Ruby on Rails as an API and Next.js for the UI. While JWT auth is possible with Rails, most auth implementations are session based, included the built in auth solution to the latest Rails 8 release. Thus I wanted to figure out how to best set up Zero while still using the built in session based auth.

In this reply @aa, outlined how the Zero constructor can take a function for the auth param https://bsky.app/profile/aaronboodman.com/post/3ldyz5bet3s2s

This all sounds right. The auth param to Zero's constructor can be a function. When the token expires, Zero invokes the function to get a new token. It's async so you can call an endpoint or whatever.

and later

To clarify further:

  • keep the refresh token in an http-only cookie
@aradalvand
aradalvand / DockerfileForSvelteKit.md
Last active March 16, 2025 13:26
Dockerfile and .dockerignore for SvelteKit:

*This Dockerfile is intended for SvelteKit applications that use adapter-node. So, the Dockerfile below assumes that you have already installed and configured the adapter.

Dockerfile:

FROM node:18-alpine AS builder
WORKDIR /app
COPY package*.json .
RUN npm ci
COPY . .
RUN npm run build
using namespace System.Management.Automation
using namespace System.Management.Automation.Language
if ($host.Name -eq 'ConsoleHost')
{
Import-Module PSReadLine
}
#Import-Module PSColors
#Import-Module posh-git
Import-Module -Name Terminal-Icons
@neelbhanushali
neelbhanushali / usb-connected-hand-held-barcode-scanner-input.js
Last active December 30, 2024 15:04
Javascript for detecting usb connected - hand held - barcode scanner input
// Author: Neel Bhanushali <[email protected]>
document.addEventListener('keydown', function(e) {
// add scan property to window if it does not exist
if(!window.hasOwnProperty('scan')) {
window.scan = []
}
// if key stroke appears after 10 ms, empty scan array
if(window.scan.length > 0 && (e.timeStamp - window.scan.slice(-1)[0].timeStamp) > 10) {
window.scan = []
@hectorguo
hectorguo / getLocalIP.js
Last active November 25, 2024 13:47
Get local IP address through Javascript
/**
* Get Local IP Address
*
* @returns Promise Object
*
* getLocalIP().then((ipAddr) => {
* console.log(ipAddr); // 192.168.0.122
* });
*/
function getLocalIP() {
@Fusselwurm
Fusselwurm / marker.sqf
Last active December 17, 2015 00:09
In ArmA, set a fuzzy marker on a player's position
private ["_markerPos", "_inner_marker", "_helper_marker"];
trackingPrecision = 50; //marker precision (radius)
gpsSleepTimeMin = 120;
gpsSleepTimeMax = 300;
_markerPos = (getPos _this);
_inner_marker = createMarker ["agentmarker", _markerPos];
@aras-p
aras-p / preprocessor_fun.h
Last active July 1, 2025 20:12
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,