Skip to content

Instantly share code, notes, and snippets.

@fidaay
fidaay / api-form-submit.js
Created March 7, 2021 19:26 — forked from whoisryosuke/api-form-submit.js
React - Handling forms and submitting POST data to API -- @see: https://reactjs.org/docs/forms.html
class NameForm extends React.Component {
constructor(props) {
super(props);
this.state = { name: '' };
}
handleChange = (event) => {
this.setState({[event.target.name]: event.target.value});
}
@fidaay
fidaay / culture_to_currency.json
Created October 25, 2022 18:38 — forked from hemstreet/culture_to_currency.json
Mapping of culture code to three-character ISO 4217 currency symbol
[{"af-ZA":"ZAR"},
{"af-ZA":"ZAR"},
{"am-ET":"ETB"},
{"ar-AE":"AED"},
{"ar-BH":"BHD"},
{"ar-DZ":"DZD"},
{"ar-EG":"EGP"},
{"ar-IQ":"IQD"},
{"ar-JO":"JOD"},
{"ar-KW":"KWD"},
@fidaay
fidaay / Nested-Routers-Express.md
Created November 21, 2022 18:52 — forked from zcaceres/Nested-Routers-Express.md
Child Routers in Express

Nested Routers in Express.js

Express makes it easy to nest routes in your routers. But I always had trouble accessing the request object's .params when you had a long URI with multiple parameters and nested routes.

Let's say you're building routes for a website www.music.com. Music is organized into albums with multiple tracks. Users can click to see a track list. Then they can select a single track and see a sub-page about that specific track.

At our application level, we could first have a Router to handle any requests to our albums.

const express = require('express');
@fidaay
fidaay / config-override.js
Created May 31, 2023 03:38 — forked from anderjs/config-override.js
Cache Busting CRA with react-app-rewired
const path = require('path')
const { merge } = require('webpack-merge')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
module.exports = function (config) {
return merge(config, {
plugins: [
new CleanWebpackPlugin(),
],
import React, { useEffect, useRef } from 'react';
import ForceGraph3D from '3d-force-graph';
//import * as THREE from 'three';
import SpriteText from 'three-spritetext';
const TechGraph = () => {
const graphRef = useRef(null);
useEffect(() => {
const graphData = {
"nodes": [
{ "id": "JavaScript", "group": "Technology" },