Skip to content

Instantly share code, notes, and snippets.

View muhammadk1607's full-sized avatar
:electron:

Muhammad Khan muhammadk1607

:electron:
View GitHub Profile
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active August 25, 2025 12:19
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Want more content like this, for free? Check out my free book, RailsAI!

Alt Text

@muhammadk1607
muhammadk1607 / code_to_dial_code.json
Last active February 24, 2023 11:05
Country and Dial or Phone codes in JSON format
{
"AF": "+93",
"AX": "+358",
"AL": "+355",
"DZ": "+213",
"AS": "+1684",
"AD": "+376",
"AO": "+244",
"AI": "+1264",
"AQ": "+672",
@kohheepeace
kohheepeace / memo.md
Last active January 27, 2025 08:31
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 !
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active September 5, 2025 16:19
A shellscript to create a Postman .deb file, for simple installation on Debian-based Linux distro's. Also creates a .desktop file.
#!/bin/sh
# SPDX-FileCopyrightText: 2017-2024 SanderTheDragon <[email protected]>
#
# SPDX-License-Identifier: MIT
arch=$(dpkg --print-architecture)
echo "Detected architecture: $arch"
case "$arch" in
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@parmentf
parmentf / GitCommitEmoji.md
Last active September 22, 2025 13:56
Git Commit message Emoji

Inspired by dannyfritz/commit-message-emoji

See also gitmoji.

Commit type Emoji
Initial commit πŸŽ‰ :tada:
Version tag πŸ”– :bookmark:
New feature ✨ :sparkles:
Bugfix πŸ› :bug:
@ygotthilf
ygotthilf / jwtRS256.sh
Last active September 16, 2025 08:53
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub