This file contains 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
//https://formik.org/docs/overview | |
/** | |
Source: https://formik.org/docs/tutorial | |
Search for "message if the field is invalid and it has been touched" to find the example variabled used in this component. for example: MyTextInput | |
* | |
*/ | |
import { useField } from 'formik'; | |
export const MyTexArea = ({ label, ...props }) => { | |
// useField() returns [formik.getFieldProps(), formik.getFieldMeta()] | |
// which we can spread on <input>. We can use field meta to show an error |
This file contains 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
// Recursive version | |
// Similar to https://gist.github.com/edwinaquino/2c32637d6a15348667c2df673cc196b5 | |
// Create a node | |
class Node { | |
constructor(val) { | |
this.data = val; | |
this.next = null; | |
} | |
} |
This file contains 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
// Create a node | |
class Node { | |
constructor(val) { | |
this.data = val; | |
this.next = null; | |
} | |
} | |
let head; | |
This file contains 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
// Edwin Aquino | |
// The purpose of this simple script is to find the index in an array using the Binary Search Method. | |
// Function to search for a match in all the elements in an array | |
function binarySearch(arr, e) { | |
// declare and assign the first element index | |
let head = 0; | |
// declare and assign the last element index | |
let tail = arr.length - 1; | |
// declare and assign the middle point of the array | |
let mid = Math.floor((head + tail) / 2); |
This file contains 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
// December 15, 2021 . Edwin Aquino | |
// The purpose of this simple script is to find the index in an array using the Linear Search Method. | |
// Function to search for a match in all the elements in an array | |
function linearSearch(arr, e) { | |
// Use a loop to irritate through the loop | |
for (let i = 0; i < arr.length; i++) { | |
// Identify the match and return the index value | |
if(arr[i] ===e) return i; | |
} |