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
@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",
@fasalmbt
fasalmbt / solution.py
Created December 15, 2020 07:40
Generate QR Codes
#QRCode geneartion made easy
import os
import pyqrcode
from PIL import Image
class QRCode(object):
def __init__(self,text):
self.qr_image = self.qr_generator(text)
@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>()
@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
function hostReachable() {
// Handle IE and more capable browsers
var xhr = new ( window.ActiveXObject || XMLHttpRequest )( "Microsoft.XMLHTTP" );
var status;
var server = window.location.hostname;
if (window.location.port != '') {
server += ':'+window.location.port;
}
@gilsonviana
gilsonviana / react-native-reanimate-more.tsx
Last active May 31, 2021 18:12
React Native + Reanimated + PanGestureHandler + TapGestureHandler
import React, { useState } from 'react';
import { StyleSheet, View, Dimensions } from 'react-native';
import Animated, {
useSharedValue,
useAnimatedGestureHandler,
withSpring,
useAnimatedStyle,
withTiming,
useDerivedValue,
runOnJS
@coryhouse
coryhouse / install.sh
Last active August 23, 2021 01:53
Dependencies for React Auth0 on Pluralsight - Last Updated 7/15/2020
npm install auth0-js@9.13.4 auth0-lock@11.25.1 express@4.17.1 express-jwt@5.3.1 express-jwt-authz@1.0.0 jwks-rsa@1.3.0 npm-run-all@4.1.5 react-router-dom@5.2.0
@fakhrulhilal
fakhrulhilal / JwtSessionMiddleware.cs
Created June 13, 2023 08:52
ASP.NET core middleware to block JWT token containing blacklisted JTI
using System.IdentityModel.Tokens.Jwt;
using System.Security.Claims;
using System.Text.Json;
using System.Text.Json.Serialization;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.IdentityModel.Tokens;
/// <summary>
/// Reject JWT token containing blacklisted JTI. The JTI is registered into cache provider to be blacklisted,
@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
@manzoorwanijk
manzoorwanijk / yup-with-final-form.js
Last active August 31, 2023 20:16
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),