This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as esbuild from 'esbuild-wasm' | |
import axios from 'axios' | |
export const unpkgPathPlugin = () => { | |
return { | |
name: 'unpkg-path-plugin', | |
setup(build: esbuild.PluginBuild) { | |
build.onResolve({ filter: /.*/ }, async (args) => { | |
console.log('onResolve', args) | |
if(args.path === 'index.js'){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface childProps { | |
name: string; | |
} | |
export const Child = (props: childProps) => <></> | |
export const ChildWithFC: React.FC<childProps> = (props) => <></> | |
//Notes: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useState } from "react" | |
const defaultFormData = { | |
title: "", | |
body: "" | |
} | |
export default function Form() { | |
const [formData, setFormData] = useState(defaultFormData) | |
const { title, body } = formData |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let arr = [1, 2, 3, 4, 5, 6, 7]; | |
function inBetween(a,b){ | |
return function(num){ | |
return (num >=a && num <= b) | |
} | |
} | |
function inArray(arr){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="spin"></div> | |
</template> | |
<style> | |
.spin{ | |
display: block; | |
width: 40px; | |
height: 40px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const data = []; | |
const error = null; | |
const load = async () => { | |
try{ | |
let response = await fetch('') | |
if(!data.ok){ | |
throw Error('error message') | |
} | |
data = await response.json() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DecimalToBinary{ | |
public state void main(String[] args){ | |
String binary = findBinary(233, ""); | |
} | |
public state String findBinary(int decimal, String result){ | |
if(decimal == 0){ | |
return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isPalindrome(input){ | |
if(input.length == 0 || input.length ==1 ){ | |
return true | |
} | |
if(input.charAt(0) == input.charAt(input.length -1 )){ | |
return isPalindrome(input.substring(1, input.length -1) | |
} | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function reverseString(input){ | |
if(input == ""){ | |
return '' | |
} | |
return reverseString(input.substring(1)) + input.charAt(0) | |
} | |
reverseString("Kehinde") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Given a form, | |
<form onSubmit={props.submitLaunch}> | |
<label htmlFor="launch-day">Launch Date</label> | |
<input type="date" id="launch-day" name="launch-day" min={today} max="2040-12-31" defaultValue={today} /> | |
<label htmlFor="mission-name">Mission Name</label> | |
<input type="text" id="mission-name" name="mission-name" /> | |
<label htmlFor="rocket-name">Rocket Type</label> | |
<input type="text" id="rocket-name" name="rocket-name" defaultValue="Explorer IS1" /> | |
<label htmlFor="planets-selector">Destination Exoplanet</label> |