Skip to content

Instantly share code, notes, and snippets.

View over40dev's full-sized avatar
🎯
Lifelong Learning

over40dev over40dev

🎯
Lifelong Learning
View GitHub Profile
@over40dev
over40dev / typescript-basics.ts
Last active October 18, 2021 23:22
Basic intro to TypeScript (Based on Traversy Media YouTube Crash Course)
// Basic Types
let id : number = 5;
let company : string = 'Me Inc.';
let isPub : boolean = true;
let x : any = 'Hello';
// Arrays
let ids : number[] = [1, 2, 3, 4, 5];
// Tuple
@over40dev
over40dev / react-typescript-basic-component.tsx
Created October 18, 2021 23:34
React TypeScript Basic Component
interface Props {
title : string
color?: string
}
const Header = (props : Props) => {
return (
<header>
<h1
style={{
// see YouTube video from Basarat (https://youtu.be/8KIkLPQPt98)
// Example 1 - Template Literal Types - Basic
let jsStringLiteral: string;
jsStringLiteral = 'Hello';
jsStringLiteral = 'World';
let jsTemplateLiteral: `Example: ${string}`; // Okay
jsTemplateLiteral = `Example: ${jsStringLiteral}`; // Okay
jsTemplateLiteral = `Example: ${3.14}`; // Okay
<!DOCTYPE html>
<html lang="en">
<!-- See Kevin Powell (KP) [https://youtu.be/HJ0-fUJ-2F0] for definitions -->
<!-- <head> is our meta data (not visible on page) -->
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Basics</title>
</head>
@over40dev
over40dev / index.ts
Created February 23, 2022 14:28
Clean Code - IF Statements
// See [basarat] (https://github.com/basarat/demo-guard-clauses)
class Person {
age?: number;
experience?: number;
}
// demo-guard-clauses
function update(button: number, person: Person | null) {
if (button !== 1 || !person) { return; }
if (person.age == null) { throw new Error('Person age not set'); }
@over40dev
over40dev / Excel_LAMBDA_examples.txt
Last active February 23, 2024 23:41
Excel_LAMBDA_examples
/* See YouTube - Excel RECURSIVE Lambda (https://youtu.be/L7s6Dni1dG8) */
/*
FUNCTION NAME: MegaReplace
DESCRIPTION: Recursive LAMBDA for clean data given errors to look for and corrections. Recursively calls MegaReplace using Offset for Before|After table cells until end of table (i.e. blank cell)
ARGS:
text_to_correct: Contains the first table cell of data to be cleaned,
before_text: First cell of Before|After table of corrections [BEFORE] column,
after_text: First cell of Before|After table of corrections [AFTER] column
EXAMPLE:
=MegaReplace([@Skills],$F$3,$G$3) // Skills is column in main table; F | G are first cells in Before|After table