Skip to content

Instantly share code, notes, and snippets.

View GraySmith00's full-sized avatar

Gray Smith GraySmith00

View GitHub Profile
@samselikoff
samselikoff / git.diff
Created November 21, 2023 14:36
Diff from "Optimistic UI in Remix": https://www.youtube.com/watch?v=d0p95C3Kcsg
diff --git a/app/components/entry-form.tsx b/app/components/entry-form.tsx
index 50e5aeb..84c64fc 100644
--- a/app/components/entry-form.tsx
+++ b/app/components/entry-form.tsx
@@ -1,6 +1,6 @@
-import { useFetcher } from "@remix-run/react";
+import { Form, useSubmit } from "@remix-run/react";
import { format } from "date-fns";
-import { useEffect, useRef } from "react";
+import { useRef } from "react";
@degitgitagitya
degitgitagitya / .env
Last active April 28, 2025 06:34
Next JS + Next Auth + Keycloak + AutoRefreshToken
# KEYCLOAK BASE URL
KEYCLOAK_BASE_URL=
# KEYCLOAK CLIENT SECRET
KEYCLOAK_CLIENT_SECRET=
# KEYCLOAK CLIENT ID
KEYCLOAK_CLIENT_ID=
# BASE URL FOR NEXT AUTH
@bradtraversy
bradtraversy / node_nginx_ssl.md
Last active June 16, 2025 06:36
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@ascendbruce
ascendbruce / README.md
Last active June 22, 2025 05:42
Use macOS-style shortcuts in Windows

Use macOS-style shortcuts in Windows / keyboard mappings using a Mac keyboard on Windows

ℹ️ There is a newer alternative project that does similar things and more, check it out at https://github.com/stevenilsen123/mac-keyboard-behavior-in-windows

Make Windows PC's shortcut act like macOS (Mac OS X) (using AutoHotkey (ahk) script)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.

How does it work

@varmais
varmais / thinced.js
Created October 1, 2015 19:43
Geolocation to Promise wrap example
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
@paulirish
paulirish / bling.js
Last active May 26, 2025 20:31
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@Kartones
Kartones / postgres-cheatsheet.md
Last active June 18, 2025 16:41
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@joyrexus
joyrexus / README.md
Last active May 16, 2025 01:54 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})