Skip to content

Instantly share code, notes, and snippets.

@dantesbytes
dantesbytes / Complete Guide to Fetch API with Examples.md
Created April 1, 2025 03:11
Complete Guide to Fetch API with Examples

Complete Guide to Fetch API with Examples

The Fetch API provides a powerful and flexible way to make HTTP requests in JavaScript. This guide demonstrates each option with practical examples.

Basic Structure

fetch(resource, options)
  .then(response => response.json())
  .then(data => console.log(data))
@dantesbytes
dantesbytes / dantesapitest.js
Last active April 1, 2025 02:28
dantesapitest.js
/**
route
**/
import { fetchTransactionCount } from "../controller/transactionCountController.js"; // Ensure the correct path
export default async function transactionRoutes(fastify, options) {
fastify.post("/num", async (request, reply) => {
return fetchTransactionCount(request, reply);
});
}
@dantesbytes
dantesbytes / autoloading_example.js
Last active March 29, 2025 08:48
autoloading example
// routes/hello.js
"use strict";
export default async function (fastify, opts) {
fastify.get(
'/hello',
async function (request, reply) {
@dantesbytes
dantesbytes / ex.js
Last active March 28, 2025 05:26
auto loading fastify
The two code snippets are essentially doing the same thing, but they differ in how they handle imports and module syntax. Let's break down the key differences:
### 1. **ES Modules (First Example)**
```javascript
import path from 'path'
import autoLoad from 'fastify-autoload'
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import fastify from 'fastify'
ESP32 Wroom Module – x1
https://www.sparkfun.com/esp32-wroom-mcu-module-16mb-u-fl.html
https://www.mouser.com/c/?q=ESP32%20Wroom%20Module
https://www.amazon.com/ESP-WROOM-32-Development-Microcontroller-Integrated-Compatible/dp/B08D5ZD528?th=1
CP2102N USB - UART controller – x1
https://www.amazon.com/CP2102-Communication-Converter-Compatible-Connector/dp/B09F6CZBYT/ref=asc_df_B09F6CZBYT?mcid=48c9e05f1f493bddbf2ce088bf96c65d&hvocijid=2108389051807684369-B09F6CZBYT-&hvexpln=73&tag=hyprod-20&linkCode=df0&hvadid=721245378154&hvpos=&hvnetw=g&hvrand=2108389051807684369&hvpone=&hvptwo=&hvqmt=&hvdev=c&hvdvcmdl=&hvlocint=&hvlocphy=9010929&hvtargid=pla-2281435177378&psc=1
https://www.amazon.com/HiLetgo-CP2102-Module-Converter-Replace/dp/B01N47LXRA/ref=sr_1_5?dib=eyJ2IjoiMSJ9.-J7NOOnkJeIbketKDf9aZ1UUnXWA5oh11W6hOaM8uwC5SdBaaINuDiQkbe4dliDYVkMnDCAUamx1TCCLIRMS1rbuz7TUBnRQH5HJm7LaFTXGH2eTXjo2IZ_ZbwGowKHHQEwTU9h91NBVeoH42ZwEJZi5hH8hfLkpL2tcL8yomgXjc24Y5O_PU4VD73dnvFDpD9O1tfoDG2Mfwk_45N4z8vbz9U6MJb7tKvWREM501EA.E21gjG9WlYOP

Comprehensive Go Programming Lesson Guide

Introduction to Golang

Program Intro and Golang Installation

  • Overview of Go programming language and its philosophy
  • Go's origins and design principles
  • Setting up the Go development environment
    • Installing Go on different operating systems
  • Configuring GOPATH and workspace

Comprehensive Rust Programming Course

Introduction to Rust

Program Intro and Rust Installation

  • Overview of Rust programming language and its philosophy
  • Rust's origins and design principles (safety, concurrency, performance)
  • Setting up the Rust development environment
    • Installing Rust using rustup
  • Understanding the Rust toolchain (stable, beta, nightly)

Comprehensive Node.js Development Course

Introduction to Node.js

JavaScript Fundamentals for Node.js

  • JavaScript review and ES6+ features
  • Variables, data types, and operators
  • Functions and scope
  • Arrow functions
  • Template literals

To allow someone to create a branch of your repository on GitHub

Option 1: Add them as a collaborator (direct branch access)

  1. Go to your repository on GitHub
  2. Click on "Settings" (near the top-right)
  3. Select "Collaborators and teams" from the left sidebar
  4. Click "Add people" or "Add teams"
  5. Enter their GitHub username, full name, or email
  6. Choose an appropriate permission level:
  • Write: Can push to branches but not change settings