Skip to content

Instantly share code, notes, and snippets.

View DeepaPrasanna's full-sized avatar
🐻
exploring

Anne Deepa Prasanna DeepaPrasanna

🐻
exploring
  • Jamshedpur , India
  • 18:04 (UTC +05:30)
  • LinkedIn in/annedeepa
View GitHub Profile
function once(func) {
let hasExecuted = false;
let result;
return function () {
if (hasExecuted) return result;
hasExecuted = true;
result = func.apply(this, arguments);
func = null;
@bradtraversy
bradtraversy / typescript-crash.ts
Last active May 22, 2024 08:33
Basic intro to TypeScript (From YouTube Crash Course)
// Basic Types
let id: number = 5
let company: string = 'Traversy Media'
let isPublished: boolean = true
let x: any = 'Hello'
let ids: number[] = [1, 2, 3, 4, 5]
let arr: any[] = [1, true, 'Hello']
// Tuple
@SunnyChopper
SunnyChopper / EmployeeSearchContainer.js
Created July 4, 2021 00:27
Employee Container with `useMemo`
import React, { useEffect, useState, useMemo } from 'react';
import { fetchEmployees } from '../api/employees';
const EmployeeSearchContainer = (props) => {
const [selectedEmployee, setSelectedEmployee] = useState(null);
const [isLoading, setIsLoading] = useState(false);
const [searchText, setSearchText] = useState('');
const [employees, setEmployees] = useState([]);
function cached(fn){
// Create an object to store the results returned after each function execution.
const cache = Object.create(null);
// Returns the wrapped function
return function cachedFn (str) {
// If the cache is not hit, the function will be executed
if ( !cache[str] ) {
let result = fn(str);

MySQL Cheat Sheet

Help with SQL commands to interact with a MySQL database

MySQL Locations

  • Mac /usr/local/mysql/bin
  • Windows /Program Files/MySQL/MySQL version/bin
  • Xampp /xampp/mysql/bin

Add mysql to your PATH

@sebmarkbage
sebmarkbage / The Rules.md
Last active June 6, 2024 16:25
The Rules of React

The Rules of React

All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.

What Functions Are "Pure"?

A number of methods in React are assumed to be "pure".

On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.

@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active June 13, 2024 09:52
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.