Skip to content

Instantly share code, notes, and snippets.

View MBM1607's full-sized avatar
:electron:

Muhammad Khan MBM1607

:electron:
View GitHub Profile
@MBM1607
MBM1607 / 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",
@SanderTheDragon
SanderTheDragon / postman-deb.sh
Last active April 3, 2024 05:30
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-2022 SanderTheDragon <sanderthedragon@zoho.com>
#
# SPDX-License-Identifier: MIT
curlExists=$(command -v curl)
echo "Testing Postman version"
@kohheepeace
kohheepeace / memo.md
Last active April 27, 2024 06:41
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 !
@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
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active May 3, 2024 02:54
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!

Alt Text

First, add the ruby-openai gem! Needs to be at least version 4. Add Sidekiq too.

@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 4, 2024 09:43
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
@parmentf
parmentf / GitCommitEmoji.md
Last active May 4, 2024 16:59
Git Commit message Emoji