Skip to content

Instantly share code, notes, and snippets.

View mdestafadilah's full-sized avatar
🧠
I'm an Intuiting Ekstrovert (IE) with B Blood Type.

mDestaFadilah mdestafadilah

🧠
I'm an Intuiting Ekstrovert (IE) with B Blood Type.
View GitHub Profile
@fgilio
fgilio / axios-catch-error.js
Last active February 27, 2025 05:50
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@gaearon
gaearon / index.html
Last active April 1, 2025 01:48
Add React in One Minute
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Add React in One Minute</title>
</head>
<body>
<h2>Add React in One Minute</h2>
<p>This page demonstrates using React with no build tooling.</p>
@alvr
alvr / packages.md
Last active March 21, 2025 09:05
Available Packages

Available Packages:

Path Version Description
add-ons;addon-google_apis-google-15 3 Google APIs
add-ons;addon-google_apis-google-16 4 Google APIs
add-ons;addon-google_apis-google-17 4 Google APIs
add-ons;addon-google_apis-google-18 4 Googl
@virbo
virbo / reactnative.md
Last active February 22, 2020 04:42
Change Display Name and Package Name in React Native

Delete Folder android and ios

$ rm -rf android
$ rm -rf ios

Change name in app.json and package.json for change package name

app.json

"name": "dutainformasi.siakad",
@manzoorwanijk
manzoorwanijk / yup-with-final-form.js
Last active January 4, 2025 04:25
How to properly use yup validation schema with (React) Final Form?
import * as yup from 'yup';
import { setIn } from 'final-form';
const validationSchema = yup.object({
email: yup.string().email(),
shipping: yup.object({
name: yup.string(),
phone: yup.object({
code: yup.string().matches(/^\+\d+$/i),
number: yup.number().max(10),
@marklchaves
marklchaves / forecast.js
Last active January 23, 2021 10:24
How to read in an environment variable on Netlify using a lambda function.
/**
* This was a proof of concept for me to be able to
* retrieve an API key using a Netlify environment variable
* using this lambda function. I spent a lot of time looking
* for a complete example like this--without any luck.
*
* So, here's a step-by-step of what I did.
*
* 1) For this function to work, define the env variable in
* Netlify > Site > Build & Deploy > Environment > Edit Variables
@jordanburke
jordanburke / Upload.tsx
Last active December 29, 2020 22:44
React Simple S3 Uploader
import React, {useState} from "react";
import axios from "axios";
import config from "../config"
const endpoint = config.apiGateway.URL;
export const Upload = () => {
const [file, setFile] = useState<File | undefined>()
@nfantone
nfantone / use-validation-schema.js
Last active May 29, 2024 01:55
Use `yup` with `react-final-form`
import { setIn } from 'final-form';
import { useMemo } from 'react';
/**
* Sets the `innerError.message` in an `errors` object at the key
* defined by `innerError.path`.
* @param {Object} errors The object to set the error in.
* @param {{ path: string, message: string }} innerError A `yup` field error.
* @returns {Object} The result of setting the new error message onto `errors`.
*/
@nikolasburk
nikolasburk / nextjs-and-prisma.md
Last active July 1, 2023 22:59
Fullstack Apps with Next.js and Prisma (PostgreSQL, MySQL & SQLite)

🚀 Fullstack Apps with Next.js and Prisma

Next.js blurs the lines between client and server. It supports pre-rendering pages at build time (SSG) or request time (SSR). Prisma is the perfect companion if you need to work with a database in a Next.js app.

Here is a list of example apps that are based on Next.js and use Prisma on the server to access data from a database:

✍️ Language 🤖 Server 🔐 Authentication 🔗 URL
TypeScript API Routes Yes (via NextAuth.js) URL
TypeScript API Routes No